/** * Creates a new User model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $user = new User(['scenario' => 'create']); $profile = new Profile(); if ($user->load(Yii::$app->request->post())) { $user->setPassword(Yii::$app->request->post('User')['newPassword']); $user->generateAuthKey(); $user->save(); return $this->redirect(['view', 'id' => $user->id]); //print_r($user->attributes); } else { return $this->render('create', ['user' => $user, 'profile' => $profile]); } }