$this->data should work without any other assignments. Have a look at Model::save(). The $data that's passed in is assigned to the model near the top. Then, $this->data isn't set to false until after afterSave() is called.
On Mon, Feb 16, 2009 at 8:55 PM, RyOnLife <[email protected]> wrote: > > > I have the same question. So I can use $this->data in my model, I have this > in my controller: > > $this->Model->data = $this->data > > Doesn't feel right. Seems like an unnecessary line of code. Better way to > get at $this->data from the Model's afterSave()? > > > > ORCC wrote: >> >> >> I have the following question: >> >> I'm saving in the controller with the method: >> >> $this->Model->save($this->data); >> >> But I don't set $this->Model->data explicitly. >> >> >> How can I access to the data array in the afterSave callback? Can I >> use $this->data if that array wasn't set explicitly with $this->Model- >>>data = $this->data in the controller? >> >> I need the data in the afterSave because I have to handle a file >> upload associated to the model. >> > >> >> > > -- > View this message in context: > http://n2.nabble.com/Access-%24data-content-in-afterSave-callback-tp1330256p2338607.html > Sent from the CakePHP mailing list archive at Nabble.com. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
