# |
Jan 30th 2014, 20:32 |
BackEndCoder |
ooo, like hasmanys |
# |
Jan 30th 2014, 20:32 |
the-neon |
cake recognizes those automatically |
# |
Jan 30th 2014, 20:32 |
the-neon |
e.g. customers + customer_categories |
# |
Jan 30th 2014, 20:31 |
the-neon |
In my current app I have lot of these |
# |
Jan 30th 2014, 20:31 |
the-neon |
nope |
# |
Jan 30th 2014, 20:31 |
BackEndCoder |
i can't remember its all a big blur |
# |
Jan 30th 2014, 20:31 |
BackEndCoder |
wouldn't it be the first word in the model name? OrdersItem ? |
# |
Jan 30th 2014, 20:30 |
the-neon |
plural... |
# |
Jan 30th 2014, 20:30 |
chris______ |
ohhh right, since it is a hasmany through model |
# |
Jan 30th 2014, 20:30 |
BackEndCoder |
so the right way round would be a before z |
# |
Jan 30th 2014, 20:30 |
the-neon |
from my current experience only the second word should be plular |
# |
Jan 30th 2014, 20:30 |
BackEndCoder |
its aphabetical chris |
# |
Jan 30th 2014, 20:29 |
chris______ |
hahaha |
# |
Jan 30th 2014, 20:29 |
BackEndCoder |
damn you and your quick fingers! |
# |
Jan 30th 2014, 20:29 |
the-neon |
?! |
# |
Jan 30th 2014, 20:29 |
BackEndCoder |
orders_items |
# |
Jan 30th 2014, 20:29 |
the-neon |
order_items then yes |
# |
Jan 30th 2014, 20:29 |
chris______ |
yeap |
# |
Jan 30th 2014, 20:29 |
the-neon |
is the model Order? |
# |
Jan 30th 2014, 20:29 |
chris______ |
also my join table would be named orders_items, order_items? |
# |
Jan 30th 2014, 20:28 |
BackEndCoder |
please keep me up to date |
# |
Jan 30th 2014, 20:28 |
chris______ |
thank you, I'll do it right away and let you know |
# |
Jan 30th 2014, 20:28 |
BackEndCoder |
yes yes |
# |
Jan 30th 2014, 20:28 |
chris______ |
I see |
# |
Jan 30th 2014, 20:28 |
BackEndCoder |
but the saveAll needs to look like $this->Order->OrderItems->saveAll($data['OrderItems']); |
# |
Jan 30th 2014, 20:28 |
chris______ |
So the first save() would be to save the new Order and get its ID, and then saveAll() to save the associations? |
# |
Jan 30th 2014, 20:27 |
BackEndCoder |
you can do it from your Orders controller if you wish |
# |
Jan 30th 2014, 20:27 |
BackEndCoder |
and then saveAll after that |
# |
Jan 30th 2014, 20:27 |
BackEndCoder |
you want to do the orignal save() to save the order number |
# |
Jan 30th 2014, 20:26 |
chris______ |
Can I do the save operation from the OrdersController, or should I do it on the OrderItems Controller? |
# |
Jan 30th 2014, 20:26 |
chris______ |
I see |
# |
Jan 30th 2014, 20:26 |
BackEndCoder |
so each numerial array, is a row. you don't want to model define it again |
# |
Jan 30th 2014, 20:25 |
BackEndCoder |
chris______, ok, so you need this array set. http://bin.cakephp.org/view/338066217 see CustomerPrice. make your array look like this. and your saveAll will work |
# |
Jan 30th 2014, 20:24 |
Nick____ |
does the condition filter down? so if i filter pages but then this then joins and gets sub pages |
# |
Jan 30th 2014, 20:24 |
chris______ |
BackEndCoder: sorry I had to go out for a second, im back now. here is it http://bin.cakephp.org/view/1274421597 |
# |
Jan 30th 2014, 20:24 |
the-neon |
perhaps 'conditions' would be the key you need |
# |
Jan 30th 2014, 20:24 |
the-neon |
if you mean retrieve on the relationship |
# |
Jan 30th 2014, 20:24 |
the-neon |
output on view? |
# |
Jan 30th 2014, 20:24 |
the-neon |
retrieve? |
# |
Jan 30th 2014, 20:23 |
the-neon |
when you say show... you mean? |
# |
Jan 30th 2014, 20:23 |
Nick____ |
how hard is it to only show child pages based on a variable too? so only show child pages where active=1 |