コード例 #1
0
ファイル: CommentController.php プロジェクト: awebc/web_xbf
 protected function findModel($id)
 {
     if (($model = Comment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
 /**
  * Find model by ID.
  *
  * @param integer|array $id Comment ID
  *
  * @return Comment Model
  *
  * @throws HttpException 404 error if comment not found
  */
 protected function findModel($id)
 {
     if (is_array($id)) {
         /** @var Comment $model */
         $model = Comment::findAll($id);
     } else {
         /** @var Comment $model */
         $model = Comment::findOne($id);
     }
     if ($model !== null) {
         return $model;
     } else {
         throw new HttpException(404);
     }
 }
コード例 #3
0
 /**
  * Find model by ID.
  *
  * @param integer|array $id Comment ID
  *
  * @return Comment Model
  *
  * @throws HttpException 404 error if comment not found
  */
 protected function findModel($id)
 {
     /** @var Comment $model */
     $model = Comment::findOne($id);
     if ($model !== null) {
         return $model;
     } else {
         throw new HttpException(404, Module::t('comment', 'FRONTEND_FLASH_RECORD_NOT_FOUND'));
     }
 }