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