/**
  * @param User  $model
  * @param array $attributes
  */
 public function beforeSetAttributes($model, &$attributes)
 {
     if (empty($attributes['password'])) {
         unset($attributes['password']);
     }
     parent::beforeSetAttributes($model, $attributes);
 }
 /**
  * @param  LocalConfigItem $model
  * @return void
  */
 public function beforeSave($model)
 {
     parent::beforeSave($model);
     $value = $model->value;
     if (is_array($value) && in_array($model->type, array(LocalConfigItem::TYPE_DYNAMICARRAY, LocalConfigItem::TYPE_TWOPOWARRAY))) {
         foreach ($value as $id => $val) {
             if (empty($val)) {
                 unset($value[$id]);
             }
         }
     }
     $model->value = $value;
 }
 public function beforeSave($model)
 {
     $this->imageBehavior->imageBeforeSave($model, $model->imageBehavior->getStorePath());
     parent::beforeSave($model);
 }