public function loadModel($id) { if (!($model = Page::findOne($id))) { throw new NotFoundHttpException(Yii::t('gromver.platform', 'The requested page does not exist.')); } return $model; }
protected function launch() { if ($this->page && !$this->page instanceof Page) { $this->page = Page::findOne(intval($this->page)); } if (empty($this->page)) { throw new InvalidConfigException(Yii::t('gromver.platform', 'Page not found.')); } if ($this->useHighlights) { CkeditorHighlightAsset::register($this->getView()); } echo $this->render($this->layout, ['model' => $this->page]); }
/** * Finds the Page model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Page the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Page::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException(Yii::t('gromver.platform', 'The requested page does not exist.')); } }