creocoder / yii2-nested-sets

The nested sets behavior for the Yii framework.
Other
446 stars 129 forks source link

There are no changes in the afterSave method #119

Open alexey-bro opened 6 years ago

alexey-bro commented 6 years ago

After the model is saved in the afterSave method, the attributes of the object are old and $changedAttributes is also empty.

public function afterSave($insert, $changedAttributes) { var_dump($this->depth); //old value var_dump($changedAttributes) //empty }

ricksmort commented 1 year ago

Had similar issue myself... PHP 5 $old_title = null; $old_title = (empty($changedAttributes['title']) ? $new_title : $changedAttributes['title']); PHP 7+ $old_title = $changedAttributes['title'] ?? null;