Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function run() |
||
26 | { |
||
27 | $signupFormClass = Yii::$app->get('auth')->modelMap['signupForm']['class']; |
||
28 | $userClass = Yii::$app->get('auth')->modelMap['user']['class']; |
||
29 | $model = new $signupFormClass($this->scenario); |
||
30 | $user = new $userClass($this->scenario); |
||
31 | |||
32 | $isLoad = $model->load(Yii::$app->request->post()); |
||
33 | |||
34 | Event::trigger(self::class, static::EVENT_BEFORE_SIGNUP, new SignupEvent($this, $user, $model, ['sender' => $this])); |
||
35 | |||
36 | if ($isLoad) { |
||
37 | if ($user = $model->signup($user)) { |
||
38 | Event::trigger(self::class, static::EVENT_AFTER_SIGNUP, new SignupEvent($this, $user, $model, ['sender' => $this])); |
||
39 | } else { |
||
40 | Event::trigger(self::class, static::EVENT_ERROR_SIGNUP, new SignupEvent($this, $user, $model, ['sender' => $this])); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $this->controller->render($this->view, [ |
||
45 | 'model' => $model, |
||
46 | 'user' => $user, |
||
47 | ]); |
||
48 | } |
||
49 | } |
||
50 |