Re: Access $data content in afterSave callback
You're right! Thanks for referring me to $this->data = false in Model::save(). Turns out something else was causing the problem and that convinced me to go digging for it. brian-9 wrote: > > > $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 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. >> >> >> > >> > > > > > -- View this message in context: http://n2.nabble.com/Access-%24data-content-in-afterSave-callback-tp1330256p2338911.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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access $data content in afterSave callback
$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 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access $data content in afterSave callback
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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Access $data content in afterSave callback
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. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---