/**
  * @inheritdoc
  */
 public function scenarios()
 {
     $scenarios = parent::scenarios();
     $scenarios['restcreate'] = ['query', 'results', 'timestamp', 'language'];
     $scenarios['restupdate'] = ['query', 'results', 'timestamp', 'language'];
     return $scenarios;
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function scenarios()
 {
     $scenarios = parent::scenarios();
     $scenarios['restcreate'] = ['image', 'imageArray', 'file', 'fileArray', 'text', 'textarea', 'selectArray', 'checkboxList', 'checkboxRelation', 'color', 'date', 'datetime', 'decimal', 'number', 'password', 'selectClass', 'toggleStatus', 'sortRelationArray', 'sortRelationModel', 'i18n_image', 'i18n_imageArray', 'i18n_file', 'i18n_fileArray', 'i18n_text', 'i18n_textarea', 'i18n_selectArray', 'i18n_checkboxList', 'i18n_checkboxRelation', 'i18n_color', 'i18n_date', 'i18n_datetime', 'i18n_decimal', 'i18n_number', 'i18n_password', 'i18n_selectClass', 'i18n_toggleStatus', 'i18n_sortRelationArray', 'i18n_sortRelationModel'];
     $scenarios['restupdate'] = ['image', 'imageArray', 'file', 'fileArray', 'text', 'textarea', 'selectArray', 'checkboxList', 'checkboxRelation', 'color', 'date', 'datetime', 'decimal', 'number', 'password', 'selectClass', 'toggleStatus', 'sortRelationArray', 'sortRelationModel', 'i18n_image', 'i18n_imageArray', 'i18n_file', 'i18n_fileArray', 'i18n_text', 'i18n_textarea', 'i18n_selectArray', 'i18n_checkboxList', 'i18n_checkboxRelation', 'i18n_color', 'i18n_date', 'i18n_datetime', 'i18n_decimal', 'i18n_number', 'i18n_password', 'i18n_selectClass', 'i18n_toggleStatus', 'i18n_sortRelationArray', 'i18n_sortRelationModel'];
     return $scenarios;
 }
Exemple #3
0
 /**
  * Search for entries with cached block id in cms_nav_item_page_block_item and delete them
  */
 public function afterDelete()
 {
     if ($this->cachedDeletedId) {
         foreach (NavItemPageBlockItem::find()->where(['block_id' => $this->cachedDeletedId])->all() as $item) {
             $item->delete();
         }
     }
     parent::afterDelete();
 }
 /**
  * @inheritdoc
  */
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         foreach (StorageImage::find()->where(['filter_id' => $this->id])->all() as $img) {
             $img->delete();
         }
         return true;
     }
     return false;
 }
Exemple #5
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     /**
      * After validation event find out if default has to be set or not. Check if if current value
      * has default to 1, disabled the other default attributes.
      */
     $this->on(self::EVENT_BEFORE_INSERT, function ($event) {
         if ($this->is_default == 1) {
             self::updateAll(['is_default' => 0]);
         }
     });
     $this->on(self::EVENT_BEFORE_UPDATE, function ($event) {
         if ($this->is_default == 1) {
             $this->markAttributeDirty('is_default');
             self::updateAll(['is_default' => 0]);
         }
     });
 }
Exemple #6
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'eventBeforeInsert']);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'eventBeforeUpdate']);
 }
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_DELETE, [$this, 'eventBeforeDelete']);
 }
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'hashContent']);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'hashContent']);
 }
Exemple #9
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'encodePassword']);
 }
Exemple #10
0
 public function fields()
 {
     $fields = parent::fields();
     unset($fields['password'], $fields['password_salt'], $fields['auth_token'], $fields['is_deleted']);
     return $fields;
 }