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 {
return false;
}
}
| public boolean beforeSave ( $insert ) | ||
|---|---|---|
| $insert | boolean |
Whether this method called while inserting a record. If |
| return | boolean |
Whether the insertion or updating should continue. If |
Please login to continue.