Hi the procedure I want to fulfill is the following:
When the users updates a model, I want to check if there is a change in data. If there is, I want to send an informative email. The mail triggering happens in the controller.
After some reading, I end up using the afterSave procedure in combination with afterFind. Using these, I am checking the old values of attributes vs new values. But I don’ t know how to inform the controller that there is a change in the data in order to trigger the mail procedure.
1)Should I use an event, and in this case how the controller could notice the event that happens in model;
2)Is there a way from the controller to call the afterSave procedure of the model and get the response; (probably wrong)
For the moment I see that afterSave procedure is called in the update method of the model, but the update procedure does not check the response of afterSave procedure. So I cannot understand which object takes into consideration the response of the afterSave procedure.
As I have said in the beggining the mail triggering happens in the controller. Otherwise, I would use the afterSave method itself to trigger the mail. As I have understand, the behavior feature is used mainly for multiple inheritance.