public function _meta_init($event) { if (is_null($this->_page)) { $page = new SeoPage(); $page->view = $this->_view(); $page->action_params = $this->_action_params(); $page->save(); $this->_page = $page; } }
/** * Deletes an existing SeoMeta model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = SeoPage::find()->where(['id' => $id])->with('meta')->one(); if (is_null($model)) { throw new NotFoundHttpException('The requested page does not exist.'); } else { foreach ($model['meta'] as $m) { $m->delete(); } $model->delete(); } return $this->redirect(['index']); }