On Sat, Sep 6, 2008 at 9:30 PM, MarcS <[EMAIL PROTECTED]> wrote: > > Hi, > > I have trouble understanding why the Model::data array is being set to > false after saving the model. > Many times I need to save the model (for example because I need the > insert Id to work with a associated model) but after that I still need > to make changes the Model's data. > > I find myself doing something like > $save_data = $this->Model->save(); > $save_data['Model']['id'] = $this->id; > $this->Model->create($save_data) > > all the time. > > Is there a good way to get around that? > Am I doing something very stupid here? > > thanks, > Marc > > > hi, i think whenever we call save() method it just returns true or false value, So you are saving FALSE value in your variable and further it cannot be used. Create() method can be used when we need to save the records for specific number of times. And just making call to create() method would be enough for your controller to work properly with model using save($this->data); method. why it is if you want to save the record more than once in a loop or in any other flow.....
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
