Open alexey-bro opened 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 }
public function afterSave($insert, $changedAttributes)
{
var_dump($this->depth); //old value
var_dump($changedAttributes) //empty
}
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;
$old_title = null; $old_title = (empty($changedAttributes['title']) ? $new_title : $changedAttributes['title']);
$old_title = $changedAttributes['title'] ?? null;
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
}