Hi:
I have a code (2amigos user module) that updates attributes with “updateAttributes”, so, although I override the model, my afterSave function is not called after “updateAttributes”.
Is there any way to do something in my overrided User model (“above” his User model) to execute some code after the “updateAttributes”?
I’ve tried with Events, but no lucky:
public function init()
{
parent::init();
Event::on(\yii\db\ActiveRecord::className(), \yii\db\ActiveRecord::EVENT_AFTER_UPDATE, function ($event) {
$this->afterSave(null, $event->changedAttributes);
});
}
P.D. Obviously, I try to do something like that because I can not change the “vendor” code
I think I don’t understand the answer or I didn’t explain myself clearly.
What I need is to execute something after a “updateAttributes” (already written in a vendor class) is executed.
I can not override its functions, it would be so many changes that I’d open my own branch of the project, but I don’t want to be out of date in future updates.
So what I’m looking is to create an event that triggers after the “updateAttributes” of a model.