protected function findModel($id) { if (($model = Comment::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * 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); } }
/** * 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')); } }