Commit 5c487cdd by Carsten Brandt

Merge pull request #2457 from Theill11/update-gii-templates

Use 'Yii::$app->request->post()' instead of $_POST
parents 7e3b4c2b 276883b8
...@@ -89,7 +89,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas ...@@ -89,7 +89,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
{ {
$model = new <?= $modelClass ?>; $model = new <?= $modelClass ?>;
if ($model->load($_POST) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', <?= $urlParams ?>]); return $this->redirect(['view', <?= $urlParams ?>]);
} else { } else {
return $this->render('create', [ return $this->render('create', [
...@@ -108,7 +108,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas ...@@ -108,7 +108,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
{ {
$model = $this->findModel(<?= $actionParams ?>); $model = $this->findModel(<?= $actionParams ?>);
if ($model->load($_POST) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', <?= $urlParams ?>]); return $this->redirect(['view', <?= $urlParams ?>]);
} else { } else {
return $this->render('update', [ return $this->render('update', [
......
...@@ -16,7 +16,7 @@ public function action<?= Inflector::id2camel(trim(basename($generator->viewName ...@@ -16,7 +16,7 @@ public function action<?= Inflector::id2camel(trim(basename($generator->viewName
{ {
$model = new <?= $generator->modelClass ?><?= empty($generator->scenarioName) ? "" : "(['scenario' => '{$generator->scenarioName}'])" ?>; $model = new <?= $generator->modelClass ?><?= empty($generator->scenarioName) ? "" : "(['scenario' => '{$generator->scenarioName}'])" ?>;
if ($model->load($_POST)) { if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) { if ($model->validate()) {
// form inputs are valid, do something here // form inputs are valid, do something here
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment