public afterSave ( boolean $insert, array $changedAttributes ) | ||
$insert | boolean | whether this method called while inserting a record. If `false`, it means the method is called while updating a record. |
$changedAttributes | array | The old values of attributes that had changed and were saved. You can use this parameter to take action based on the changes made for example send an email when the password had changed or implement audit trail that tracks all the changes. `$changedAttributes` gives you the old attribute values while the active record (`$this`) has already the new, updated values. Note that no automatic type conversion performed by default. You may use [[\yii\behaviors\AttributeTypecastBehavior]] to facilitate attribute typecasting. See http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#attributes-typecasting. |