Search code examples
phpyiibefore-save

Model attributes set in beforeSave() are not being saved


I am trying to set a model attributes in beforeSave() method but they are not saved afterwards.

 public function beforeSave(){
     if(!$this->isNewRecord){
         // ...
         $this->status = self::VISIBLE;
     }               
     return parent::beforeSave();
 }

I have tried returning true instead of parent::beforeSave(). Also I have tried if(parent::beforeSave) {} structure.

I have checked model attributes in afterSave and they are set. I just don't get there they can get lost afterwards.

Any ideas?


Solution

  • I just tried to update the model without X-editable plugin and the additional attributes were set in beforeSave().