# |
Jan 30th 2014, 20:33 |
BackEndCoder |
habtm model names have the s in the middle |
# |
Jan 30th 2014, 20:33 |
the-neon |
yeah, that's the tricky mode |
# |
Jan 30th 2014, 20:33 |
BackEndCoder |
i was thinking of hasbtm joining tables |
# |
Jan 30th 2014, 20:33 |
the-neon |
^_^ |
# |
Jan 30th 2014, 20:33 |
BackEndCoder |
infact no, thats wrong, model names are the same |
# |
Jan 30th 2014, 20:32 |
the-neon |
nu |
# |
Jan 30th 2014, 20:32 |
BackEndCoder |
but model names are the other way |
# |
Jan 30th 2014, 20:32 |
BackEndCoder |
tables names are like that |
# |
Jan 30th 2014, 20:32 |
chris______ |
D |
# |
Jan 30th 2014, 20:32 |
the-neon |
hehe |
# |
Jan 30th 2014, 20:32 |
BackEndCoder |
and lists them out nicely :D |
# |
Jan 30th 2014, 20:32 |
BackEndCoder |
mysql likes them too |
# |
Jan 30th 2014, 20:32 |
BackEndCoder |
yeah |
# |
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 |