# |
Jan 30th 2014, 19:38 |
the-neon |
p |
# |
Jan 30th 2014, 19:37 |
the-neon |
i'd like a moment in the shed too |
# |
Jan 30th 2014, 19:37 |
todds |
backendcoder: Can I have the location and keys to this shed? |
# |
Jan 30th 2014, 19:35 |
chris______ |
Can I do that operation from the OrdersController right? |
# |
Jan 30th 2014, 19:35 |
BackEndCoder |
i will see if i can find something in my example shed |
# |
Jan 30th 2014, 19:35 |
chris______ |
is there any example I could read, i'm kinda new to cakephp |
# |
Jan 30th 2014, 19:34 |
chris______ |
yeah exactly |
# |
Jan 30th 2014, 19:34 |
BackEndCoder |
you are just making assosations |
# |
Jan 30th 2014, 19:34 |
BackEndCoder |
but you are not |
# |
Jan 30th 2014, 19:34 |
BackEndCoder |
it would work if you are saving orders and items |
# |
Jan 30th 2014, 19:34 |
BackEndCoder |
then use that id to push the join table |
# |
Jan 30th 2014, 19:34 |
BackEndCoder |
you would save the order id like normal with your habtm |
# |
Jan 30th 2014, 19:33 |
BackEndCoder |
the model exsists, but cake writes it itself |
# |
Jan 30th 2014, 19:33 |
BackEndCoder |
its already there. but cake will default it |
# |
Jan 30th 2014, 19:33 |
BackEndCoder |
yes |
# |
Jan 30th 2014, 19:33 |
chris______ |
? |
# |
Jan 30th 2014, 19:33 |
chris______ |
which would be the join table |
# |
Jan 30th 2014, 19:32 |
chris______ |
so I need an extra entity called OrderItems |
# |
Jan 30th 2014, 19:32 |
chris______ |
I see |
# |
Jan 30th 2014, 19:32 |
BackEndCoder |
OrderItems |
# |
Jan 30th 2014, 19:32 |
BackEndCoder |
job done |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
and save it |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
so bind it |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
that will be a hasmany |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
you are saving the joining table |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
what you are doing isn't saving habtm |
# |
Jan 30th 2014, 19:31 |
todds |
The way that convo progressed made me think of itâ?¦ had to share. :) |
# |
Jan 30th 2014, 19:31 |
BackEndCoder |
chris______, |
# |
Jan 30th 2014, 19:30 |
BackEndCoder |
todds, damn them and thier jokes :D |
# |
Jan 30th 2014, 19:29 |
chris______ |
thats what I want to do |
# |
Jan 30th 2014, 19:29 |
chris______ |
1 | 3 |
# |
Jan 30th 2014, 19:29 |
chris______ |
1 | 2 |
# |
Jan 30th 2014, 19:29 |
chris______ |
1 | 1 |
# |
Jan 30th 2014, 19:29 |
chris______ |
order_id | item_id |
# |
Jan 30th 2014, 19:29 |
chris______ |
the relationship table would have rows like this: |
# |
Jan 30th 2014, 19:29 |
chris______ |
Since I am creating Order with ID = 1, and that order contains Items with IDs: 1, 2, 3 and 4; |
# |
Jan 30th 2014, 19:28 |
todds |
sorry, I can't offer any help, but i gotta share: http://xkcd.com/1323/ |
# |
Jan 30th 2014, 19:28 |
chris______ |
so your relationship table (N:M) would have IDs for both Order and Items, right? |
# |
Jan 30th 2014, 19:28 |
the-neon |
yeah |
# |
Jan 30th 2014, 19:27 |
chris______ |
ok lets suppose you have an Order, and in that Order you have Items, right? |
# |
Jan 30th 2014, 19:25 |
the-neon |
perhaps I'm a bit confused by my own assoc issue but I can't follow -_- |