beforeSave() public method
This method is called at the beginning of inserting or updating a record. The default implementation will trigger an EVENT_BEFORE_INSERT event when $insert is true, or an EVENT_BEFORE_UPDATE event if $insert is false. When overriding this method, make sure you call the parent implementation like the following: public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
// ...custom code here...
return true;
} else {
ret