Cakephp - auto trigger application model callback with model callback
I have callback functions in AppModel.php and also for some models, there is a way to automatically call the application model callback with (preferably before) the current model callback being called.
eg. let's say i have beforeSave
in AppModel, for every beforeSave function in my models i need to put
parent::beforeSave($options)
. Now, can I do this for all models at once, so I don't have to insert every callback into every model.
thank
+3
dav
source
to share
1 answer
Nope.
Since your model extends AppModel, any of these callback functions will override the parent function. You always need to manually call the parent function.
+1
Dabrowski
source
to share