Hi all,

I've got a piece of code that does an insert, then and update of the
previous row inserted, then the code loops around and does the same
thing again for a different data set. I've found an issue that the
second time around the loop the AppModel is retaining the ID of the
previous insert and so is doing an update instead of an insert. After
stepping into the model.php source eventually found that it was
getting an ID from "$this->contr->ModelName->id" that was saved on the
previous insert.

Adding "$this->contr->ModelName->id = null" fixed the issue, and made
the model do an insert instead of an update. This feels like a hack
though, and I don't like hacks, they often come back to bite you
later.

Does anyone know why the model's retaining this ID value, and why it's
picking it up from the previous insert when it's missing from the
array of data I tell it to save?

Thanks

Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to