Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
276883b8
Commit
276883b8
authored
Feb 17, 2014
by
Johnny Theill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 'Yii::$app->request->post()' instead of $_POST
parent
93a9c5eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
controller.php
extensions/gii/generators/crud/templates/controller.php
+2
-2
action.php
extensions/gii/generators/form/templates/action.php
+1
-1
No files found.
extensions/gii/generators/crud/templates/controller.php
View file @
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', [
...
...
extensions/gii/generators/form/templates/action.php
View file @
276883b8
...
@@ -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;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment