What is difference between before save() and after save() function in yii2


(khushboo Rani) #1

Hello Sir i am new in yii2
I want to know what is difference between before save() and after save() in yii2
And how they work .
please explain me with example if anybody knew it .

Thank you


(Andro) #2

I guess you mean the functions beforeSave() and afterSave() from ActiveRecord?
https://www.yiiframework.com/doc/api/2.0/yii-db-baseactiverecord#afterSave()-detail
Did you took a look into the source code?
Where do you have problems understanding?