|
@@ -33,7 +33,7 @@ discard block |
|
|
block discarded – undo |
|
33
|
33
|
*/ |
|
34
|
34
|
$class = $this->modelClass ?: ($this->controller->createClass ?: $this->controller->modelClass); |
|
35
|
35
|
$model = new $class(); |
|
36
|
|
- $this->controller->trigger(CrudController::EVENT_BEFORE_CREATE, new Event(['model' => $model])); |
|
|
36
|
+ $this->controller->trigger(CrudController::EVENT_BEFORE_CREATE, new Event([ 'model' => $model ])); |
|
37
|
37
|
if ($this->loadDefaultValues && method_exists($model, 'loadDefaultValues')) { |
|
38
|
38
|
$model->loadDefaultValues($this->skipIfSet); |
|
39
|
39
|
} |
|
@@ -43,13 +43,13 @@ discard block |
|
|
block discarded – undo |
|
43
|
43
|
if ($model->load(Yii::$app->request->post())) { |
|
44
|
44
|
if ($model->save()) { |
|
45
|
45
|
Yii::$app->session->setFlash('success', $this->getMessageOnCreate($model)); |
|
46
|
|
- $this->controller->trigger(CrudController::EVENT_AFTER_CREATE, new Event(['model' => $model])); |
|
|
46
|
+ $this->controller->trigger(CrudController::EVENT_AFTER_CREATE, new Event([ 'model' => $model ])); |
|
47
|
47
|
return $this->controller->redirect($this->controller->createRedirect($model)); |
|
48
|
48
|
} else { |
|
49
|
|
- $this->controller->trigger(CrudController::EVENT_ERROR_CREATE, new Event(['model' => $model])); |
|
|
49
|
+ $this->controller->trigger(CrudController::EVENT_ERROR_CREATE, new Event([ 'model' => $model ])); |
|
50
|
50
|
} |
|
51
|
51
|
Yii::$app->session->setFlash('error', Html::errorSummary($model)); |
|
52
|
52
|
} |
|
53
|
|
- return $this->controller->render($this->view, ['model' => $model]); |
|
|
53
|
+ return $this->controller->render($this->view, [ 'model' => $model ]); |
|
54
|
54
|
} |
|
55
|
55
|
} |
|
56
|
56
|
\ No newline at end of file |