with('lang.alias') ->all(); $aliasIdsForBlog = [98, 99, 100]; $this->view->params['aliases'] = \artbox\core\models\Alias::find() ->where( [ 'id' => $aliasIdsForBlog ] ) ->all(); return $this->render( 'index', [ 'persones' => $persones, ] ); } /** * @param int $id * * @return string */ public function actionView(int $id) { $model = $this->findModel($id); $this->view->params['model'] = $model; return $this->render( 'view', [ 'model' => $model, ] ); } /** * @param $id * * @return array|null|\yii\db\ActiveRecord * @throws \yii\web\NotFoundHttpException */ protected function findModel($id) { $model = Persone::find() ->with('lang.alias') ->where([ 'id' => $id ]) ->one(); if (empty($model)) { throw new NotFoundHttpException(); } else { return $model; } } }