/** * Invalidate cache * * @param bool $insert * @param array $changedAttributes */ public function afterSave($insert, $changedAttributes) { TagDependency::invalidate(Yii::$app->cache, ContentModule::CACHE_TAG); parent::afterSave($insert, $changedAttributes); }
/** * @param bool $insert * @param array $changedAttributes */ public function afterSave($insert, $changedAttributes) { Yii::$app->cache->flush(); parent::afterSave($insert, $changedAttributes); }
/** * Invalidate cache * * @inheritdoc */ public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); Yii::$app->cache->delete('__globalMetaTags'); }
/** * Invalidate cache * * @param bool $insert * @param array $changedAttributes */ public function afterSave($insert, $changedAttributes) { if (!$insert and array_key_exists('content_menu_id', $changedAttributes)) { $menu = ContentMenu::find()->andWhere(['id' => $this->content_menu_id])->one(); foreach ($this->contentPages as $child) { if ($menu->has_submenu != 1) { $child->parent_id = null; } $child->content_menu_id = $this->content_menu_id; $child->save(false); } } TagDependency::invalidate(Yii::$app->cache, ContentModule::CACHE_TAG); parent::afterSave($insert, $changedAttributes); }
/** * Create ContentTemplateWidget or update it * * @inheritdoc */ public function afterSave($insert, $changedAttributes) { if ($insert) { $widget = new ContentTemplateWidget(); $widget->name = $this->name; $widget->position = $this->position; $widget->widget_class = self::WIDGET_CLASS; $widget->code = md5(__CLASS__ . '_' . $this->id); $widget->widget_options = serialize(['code' => $this->code]); $widget->has_settings = 1; $widget->link_to_settings = '/content/content-page/tree?menuId=' . $this->id; $widget->save(false); } elseif (array_key_exists('name', $changedAttributes) || array_key_exists('position', $changedAttributes) || array_key_exists('code', $changedAttributes)) { $widget = ContentTemplateWidget::findOne(['widget_class' => self::WIDGET_CLASS, 'code' => md5(__CLASS__ . '_' . $this->id)]); if ($widget) { $widget->name = $this->name; $widget->position = $this->position; $widget->widget_options = serialize(['code' => $this->code]); $widget->save(false); } } TagDependency::invalidate(Yii::$app->cache, ContentModule::CACHE_TAG); parent::afterSave($insert, $changedAttributes); }