Re: HABTM Join Table Entries Disappearing
Thanks guys for your help.
I think that I have found what is causing the problem but I need some feedback to see if it's probable.
Lets say I have the models 'Order' and 'Cart' which have a HABTM relationship with a join model 'CartsOrder'.
When I run this:
$order = $this->Order->find('first');$this->Order->save($order);
It will:
1) UPDATE the orders table2) DELETE all of the joins in the 'carts_orders' table3) INSERT the new joins to the 'carts_orders' table, one by one.
That seems to work properly but what if I ran the above code multiple times at once? What if the find was called before the last instance of done writing all the inserts? You would get an incomplete find and then the save after that would not write the missing joins. That would result in missing joins.
Thoughts?
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home