Example #1
0
 public function actionShow($id)
 {
     $page = Page::findOne(['id' => $id]);
     if (is_null($page)) {
         throw new NotFoundHttpException();
     }
     return $this->render('index.tpl', ['page' => $page]);
 }
Example #2
0
 /**
  * @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.');
     }
 }