Wednesday, October 8, 2014

Re: Best practice for changing entity in afterSave

That is exactly the case. The entity returned by the save function does not have the changes applied in the afterSave.

I'll put an example on Github to demonstrate my problem.



On Tuesday, 7 October 2014 15:20:10 UTC+1, heavyKevy wrote:
It seems to me that the entity used to save the record in the save call is updated and available in the controller after the save call is complete...
Are you saying that modifications in that Entity are not showing up in the controller afterwards?

On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
Hi all, back again with another question:

In our old 1.3 app, I used $this->someValue = $someData; in an afterSave function to pass values back up to a controller.

I have tried to use a $entity->set('someValue', $someData); in an afterSave in the new cake3 table model, but this entity does not appear to be available to me back at the controller layer. 

Has any one got any pointers as to the correct way to achieve this (That is, get a value at the controller, that has been set at the table model in afterSave)?

Thanks in advance.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: