Trigger - When change

Trigger when change

I have 4 tables in database; users allow adding new and updating the fields in any table via program. There are several screens for the operations

There is another table called declaration, purpose of that user agrees on what he/she enter, I got date and time with other variable and finally set confirmed field to 1 (one) that means user confirmed.

My question is, how do I implement a method using YII 2 to set the confirmed field back to 0 (Zero) when user made any changes to the above tables

Thank in advance

Leulae

If you need to do it for all changes regardless if these are made via AR or not, use DB triggers (not Yii). If you expect AR to be used, try afterSave() and beforeSave().