Esempio n. 1
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();
 }
Esempio n. 2
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         foreach (StorageImage::find()->where(['filter_id' => $this->id])->all() as $img) {
             $img->delete();
         }
         return true;
     }
     return false;
 }
Esempio n. 3
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_DELETE, [$this, 'eventBeforeDelete']);
 }
Esempio n. 4
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'eventBeforeInsert']);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'eventBeforeUpdate']);
 }
Esempio n. 5
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'encodePassword']);
 }
Esempio n. 6
0
 public function fields()
 {
     $fields = parent::fields();
     unset($fields['password'], $fields['password_salt'], $fields['auth_token'], $fields['is_deleted']);
     return $fields;
 }
Esempio n. 7
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'beforeCreate']);
 }