with('lang.alias') ->all(); return $this->render( 'index', [ 'persones' => $persones, ] ); } /** * @param int $id * * @return string */ public function actionView(int $id) { $model = $this->findModel($id); 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; } } }