it's in here http://tempdocs.cakephp.org/#TOC73001 and http://manual.cakephp.org/chapter/models and http://api.cakephp.org/1.2/class_model.html#ffd04e1cae18cb61d1e219f5283eab35 the nice thing about create is that you can initialize your model with default data as well
SamD On Feb 6, 2008 7:02 PM, Tim W <[EMAIL PROTECTED]> wrote: > > Thanks Samuel, I didn't think to check if there was a create type > method, cheers :) > > On Feb 7, 3:00 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote: > > I usually use $this->ModelName->create(); > > > > On Feb 6, 2008 5:50 PM, Tim W <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > 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 > > > > -- > > -- > > (the old fart) the advice is free, the lack of crankiness will cost you > > > > - its a fine line between a real question and an idiot > > > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/http://blog.samdevore.com/cakephp-pages/i-cant-bake/ > > > > -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
