/** * Creates a new User model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new User(); if (Yii::$app->request->isPost) { $model->load(Yii::$app->request->post()); if ($model->save()) { $userdata = new WooUserData(); $userdata->user_id = $model->id; $userdata->user_name = "Unset"; $userdata->user_lastname = "Unset"; $model->link("woouserdata", $userdata); return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model]); } }