public function actionUpdateAccount($id_user = null) { $model = new Account(); if ($id_user) { $account = User::findIdentity($id_user)->findAccount(); //var_dump($user->username);die; } else { $account = Yii::$app->user->identity->findAccount(); if (Yii::$app->session->get('account') == null) { Yii::$app->session->set('account', Yii::$app->user->findAccount()); } } if ($model->load(Yii::$app->request->post() && $model->validate())) { } else { return $this->render('update-account', ['model' => $model, 'account' => $account]); } }