/** * 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(); }
public function beforeDelete() { if (parent::beforeDelete()) { foreach (StorageImage::find()->where(['filter_id' => $this->id])->all() as $img) { $img->delete(); } return true; } return false; }
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, 'eventBeforeInsert']); $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'eventBeforeUpdate']); }
public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, [$this, 'encodePassword']); }
public function fields() { $fields = parent::fields(); unset($fields['password'], $fields['password_salt'], $fields['auth_token'], $fields['is_deleted']); return $fields; }
public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, [$this, 'beforeCreate']); }