M
M
Michael2016-06-02 22:48:12
Yii
Michael, 2016-06-02 22:48:12

How in Yii2 in the model to determine whether the values ​​have changed?

If the values ​​have changed, then you need to perform certain actions in afterSave().
Is it possible?
update:
Model - ActiveRecord.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-06-03
@springimport

Maxim Fedorov gave a good option, I'll add a less correct one, but it will work in yii\base\Model
Add the public $old_value variable to the model, assign a value in afterFind, then check aftersave

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question