Commit e82beebc3a5ae0b05fc758928a4b8b11a8ef047c
1 parent
93a7a3c1
test
Showing
2 changed files
with
14 additions
and
2 deletions
Show diff stats
frontend/controllers/CompanyController.php
| @@ -259,6 +259,9 @@ | @@ -259,6 +259,9 @@ | ||
| 259 | ]) | 259 | ]) |
| 260 | ->with('portfolioUsers.gallery') | 260 | ->with('portfolioUsers.gallery') |
| 261 | ->one(); | 261 | ->one(); |
| 262 | + if(empty($portfolio)) { | ||
| 263 | + throw new NotFoundHttpException('Портфолио не найдено'); | ||
| 264 | + } | ||
| 262 | if(!empty( $portfolio_user )) { | 265 | if(!empty( $portfolio_user )) { |
| 263 | $portfolio_user = PortfolioUser::find() | 266 | $portfolio_user = PortfolioUser::find() |
| 264 | ->where([ | 267 | ->where([ |
| @@ -347,7 +350,6 @@ | @@ -347,7 +350,6 @@ | ||
| 347 | if(!$company instanceof User) { | 350 | if(!$company instanceof User) { |
| 348 | throw new BadRequestHttpException('Пользователь не найден'); | 351 | throw new BadRequestHttpException('Пользователь не найден'); |
| 349 | } | 352 | } |
| 350 | - | ||
| 351 | $article = Blog::find() | 353 | $article = Blog::find() |
| 352 | ->where([ | 354 | ->where([ |
| 353 | 'link' => $link, | 355 | 'link' => $link, |
| @@ -355,6 +357,9 @@ | @@ -355,6 +357,9 @@ | ||
| 355 | ]) | 357 | ]) |
| 356 | ->with('comments') | 358 | ->with('comments') |
| 357 | ->one(); | 359 | ->one(); |
| 360 | + if(empty($article)) { | ||
| 361 | + throw new NotFoundHttpException('Запись не найдена'); | ||
| 362 | + } | ||
| 358 | $article->updateCounters([ 'view_count' => 1 ]); | 363 | $article->updateCounters([ 'view_count' => 1 ]); |
| 359 | 364 | ||
| 360 | return $this->render('blog-view', [ | 365 | return $this->render('blog-view', [ |
frontend/controllers/PerformerController.php
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | use yii\web\BadRequestHttpException; | 17 | use yii\web\BadRequestHttpException; |
| 18 | use yii\web\Controller; | 18 | use yii\web\Controller; |
| 19 | use common\models\User; | 19 | use common\models\User; |
| 20 | + use yii\web\NotFoundHttpException; | ||
| 20 | 21 | ||
| 21 | /** | 22 | /** |
| 22 | * Site controller | 23 | * Site controller |
| @@ -68,7 +69,7 @@ | @@ -68,7 +69,7 @@ | ||
| 68 | ->one(); | 69 | ->one(); |
| 69 | 70 | ||
| 70 | if(!$user instanceof User) { | 71 | if(!$user instanceof User) { |
| 71 | - throw new BadRequestHttpException('Пользователь не найден'); | 72 | + throw new NotFoundHttpException('Пользователь не найден'); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | $educations = Fields::getData($user->id, $user->className(), 'education'); | 75 | $educations = Fields::getData($user->id, $user->className(), 'education'); |
| @@ -193,6 +194,9 @@ | @@ -193,6 +194,9 @@ | ||
| 193 | ]) | 194 | ]) |
| 194 | ->with('portfolioUsers.gallery') | 195 | ->with('portfolioUsers.gallery') |
| 195 | ->one(); | 196 | ->one(); |
| 197 | + if(empty($portfolio)) { | ||
| 198 | + throw new NotFoundHttpException('Портфолио не найдено'); | ||
| 199 | + } | ||
| 196 | if(!empty( $portfolio_user )) { | 200 | if(!empty( $portfolio_user )) { |
| 197 | $portfolio_user = PortfolioUser::find() | 201 | $portfolio_user = PortfolioUser::find() |
| 198 | ->where([ | 202 | ->where([ |
| @@ -283,6 +287,9 @@ | @@ -283,6 +287,9 @@ | ||
| 283 | ]) | 287 | ]) |
| 284 | ->with('comments') | 288 | ->with('comments') |
| 285 | ->one(); | 289 | ->one(); |
| 290 | + if(empty($article)) { | ||
| 291 | + throw new NotFoundHttpException('Запись не найдена'); | ||
| 292 | + } | ||
| 286 | $article->updateCounters([ 'view_count' => 1 ]); | 293 | $article->updateCounters([ 'view_count' => 1 ]); |
| 287 | 294 | ||
| 288 | return $this->render('blog-view', [ | 295 | return $this->render('blog-view', [ |