public function actionShow($id) { $page = Page::findOne(['id' => $id]); if (is_null($page)) { throw new NotFoundHttpException(); } return $this->render('index.tpl', ['page' => $page]); }
/** * @param integer $id * * @return Page * * @throws NotFoundHttpException */ protected function findModel($id) { if (($model = Page::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }