diff --git a/frontend/controllers/CompanyController.php b/frontend/controllers/CompanyController.php index 35869c0..6f33380 100755 --- a/frontend/controllers/CompanyController.php +++ b/frontend/controllers/CompanyController.php @@ -259,6 +259,9 @@ ]) ->with('portfolioUsers.gallery') ->one(); + if(empty($portfolio)) { + throw new NotFoundHttpException('Портфолио не найдено'); + } if(!empty( $portfolio_user )) { $portfolio_user = PortfolioUser::find() ->where([ @@ -347,7 +350,6 @@ if(!$company instanceof User) { throw new BadRequestHttpException('Пользователь не найден'); } - $article = Blog::find() ->where([ 'link' => $link, @@ -355,6 +357,9 @@ ]) ->with('comments') ->one(); + if(empty($article)) { + throw new NotFoundHttpException('Запись не найдена'); + } $article->updateCounters([ 'view_count' => 1 ]); return $this->render('blog-view', [ diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php index f100a21..99df52d 100755 --- a/frontend/controllers/PerformerController.php +++ b/frontend/controllers/PerformerController.php @@ -17,6 +17,7 @@ use yii\web\BadRequestHttpException; use yii\web\Controller; use common\models\User; + use yii\web\NotFoundHttpException; /** * Site controller @@ -68,7 +69,7 @@ ->one(); if(!$user instanceof User) { - throw new BadRequestHttpException('Пользователь не найден'); + throw new NotFoundHttpException('Пользователь не найден'); } $educations = Fields::getData($user->id, $user->className(), 'education'); @@ -193,6 +194,9 @@ ]) ->with('portfolioUsers.gallery') ->one(); + if(empty($portfolio)) { + throw new NotFoundHttpException('Портфолио не найдено'); + } if(!empty( $portfolio_user )) { $portfolio_user = PortfolioUser::find() ->where([ @@ -283,6 +287,9 @@ ]) ->with('comments') ->one(); + if(empty($article)) { + throw new NotFoundHttpException('Запись не найдена'); + } $article->updateCounters([ 'view_count' => 1 ]); return $this->render('blog-view', [ -- libgit2 0.21.4