thanks for all stackoverflow members, I learned a lot from here.
I have a question about "beforeSave", I want save the old data to history-table in the database, for example if the user change anything I want save the old informations in the history-table.
Can anyone tell me what's the "best" scenario to achieve this ?
Thank you all and all suggestions are welcome.
You must add the beforSave() function in your model.
Check if the param $insert is false theis mean you are updateing a record so in this case you can create a new HistoryModel, polutate and save
http://www.yiiframework.com/doc-2.0/yii-db-baseactiverecord.html#beforeSave%28%29-detail