Google News
logo
CakePHP - Interview Questions
List few callback functions in CakePHP?
Callback function is used to so some logic before or after doing a database related operation. Some of the callback methods are,
 
beforeFind(array $query): This is called before doing find operation to execute the query that is passes to the function.

afterFind(array $results, boolean $primary = false): This is called after executing the find operation and is used to modify the results from it.

beforeValidate(array $options = array()) : It is used to modify data before it is validated.

afterValidate() : It is used to do data clean up after validation process.

beforeSave(array $options = array()) : It is used to do any logic before saving operation.

beforeSave(array $options = array()) : It is used to do logic after the save operation.

beforeDelete(boolean $cascade = true) : It is used to do pre-deletion logic.

afterDelete() : It is used to do logic after deletion.

onError() : It is called if any error occurs.
Advertisement