findModel($id); /** * @var SeoComponent $seo */ $seo = Yii::$app->get('seo'); $seo->setModel($model->lang); if (strpos($model->lang->body, '[[gallery]]')) { $splited = explode('[[gallery]]', $model->lang->body); $body = array_shift($splited); $lefts = implode('', $splited); } else { $body = $model->lang->body; $lefts = null; } $pages = Page::find() ->with('lang') ->where( [ 'not', [ 'id' => $id ], ] ) ->limit(5) ->all(); return $this->render( 'view', [ 'model' => $model, 'pages' => $pages, 'body' => $body, 'lefts' => $lefts, 'images' => $model->getImages(), ] ); } protected function findModel($id) { /** * @var Page $model * @var SeoComponent $seo */ $seo = \Yii::$app->get('seo'); $model = Page::find() ->where( [ 'id' => $id, ] ) ->with('lang') ->one(); if (!empty($model)) { if ($model->lang->alias_id !== $seo->aliasId) { throw new NotFoundHttpException('Wrong language'); } return $model; } else { throw new NotFoundHttpException('Model not found'); } } }