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
9c92600b
Commit
9c92600b
authored
Jun 08, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3728 from umneeq/gii-codestyle-fixes
Gii codestyle fixes
parents
03efbc4c
27a9bc75
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
Generator.php
extensions/gii/Generator.php
+1
-1
controller.php
extensions/gii/generators/crud/default/controller.php
+3
-3
_form.php
extensions/gii/generators/crud/default/views/_form.php
+1
-1
Generator.php
extensions/gii/generators/form/Generator.php
+1
-1
action.php
extensions/gii/generators/form/default/action.php
+1
-1
No files found.
extensions/gii/Generator.php
View file @
9c92600b
...
@@ -310,7 +310,7 @@ abstract class Generator extends Model
...
@@ -310,7 +310,7 @@ abstract class Generator extends Model
*/
*/
public
function
render
(
$template
,
$params
=
[])
public
function
render
(
$template
,
$params
=
[])
{
{
$view
=
new
View
;
$view
=
new
View
()
;
$params
[
'generator'
]
=
$this
;
$params
[
'generator'
]
=
$this
;
return
$view
->
renderFile
(
$this
->
getTemplatePath
()
.
'/'
.
$template
,
$params
,
$this
);
return
$view
->
renderFile
(
$this
->
getTemplatePath
()
.
'/'
.
$template
,
$params
,
$this
);
...
...
extensions/gii/generators/crud/default/controller.php
View file @
9c92600b
...
@@ -64,8 +64,8 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
...
@@ -64,8 +64,8 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
public function actionIndex()
public function actionIndex()
{
{
<?php
if
(
!
empty
(
$generator
->
searchModelClass
))
:
?>
<?php
if
(
!
empty
(
$generator
->
searchModelClass
))
:
?>
$searchModel = new
<?=
isset
(
$searchModelAlias
)
?
$searchModelAlias
:
$searchModelClass
?>
;
$searchModel = new
<?=
isset
(
$searchModelAlias
)
?
$searchModelAlias
:
$searchModelClass
?>
()
;
$dataProvider = $searchModel->search(Yii::$app->request->
getQueryParams()
);
$dataProvider = $searchModel->search(Yii::$app->request->
queryParams
);
return $this->render('index', [
return $this->render('index', [
'searchModel' => $searchModel,
'searchModel' => $searchModel,
...
@@ -101,7 +101,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
...
@@ -101,7 +101,7 @@ class <?= $controllerClass ?> extends <?= StringHelper::basename($generator->bas
*/
*/
public function actionCreate()
public function actionCreate()
{
{
$model = new
<?=
$modelClass
?>
;
$model = new
<?=
$modelClass
?>
()
;
if ($model->load(Yii::$app->request->post())
&&
$model->save()) {
if ($model->load(Yii::$app->request->post())
&&
$model->save()) {
return $this->redirect(['view',
<?=
$urlParams
?>
]);
return $this->redirect(['view',
<?=
$urlParams
?>
]);
...
...
extensions/gii/generators/crud/default/views/_form.php
View file @
9c92600b
...
@@ -9,7 +9,7 @@ use yii\helpers\StringHelper;
...
@@ -9,7 +9,7 @@ use yii\helpers\StringHelper;
*/
*/
/** @var \yii\db\ActiveRecord $model */
/** @var \yii\db\ActiveRecord $model */
$model
=
new
$generator
->
modelClass
;
$model
=
new
$generator
->
modelClass
()
;
$safeAttributes
=
$model
->
safeAttributes
();
$safeAttributes
=
$model
->
safeAttributes
();
if
(
empty
(
$safeAttributes
))
{
if
(
empty
(
$safeAttributes
))
{
$safeAttributes
=
$model
->
attributes
();
$safeAttributes
=
$model
->
attributes
();
...
...
extensions/gii/generators/form/Generator.php
View file @
9c92600b
...
@@ -148,7 +148,7 @@ EOD;
...
@@ -148,7 +148,7 @@ EOD;
public
function
getModelAttributes
()
public
function
getModelAttributes
()
{
{
/** @var Model $model */
/** @var Model $model */
$model
=
new
$this
->
modelClass
;
$model
=
new
$this
->
modelClass
()
;
if
(
!
empty
(
$this
->
scenarioName
))
{
if
(
!
empty
(
$this
->
scenarioName
))
{
$model
->
setScenario
(
$this
->
scenarioName
);
$model
->
setScenario
(
$this
->
scenarioName
);
}
}
...
...
extensions/gii/generators/form/default/action.php
View file @
9c92600b
...
@@ -14,7 +14,7 @@ echo "<?php\n";
...
@@ -14,7 +14,7 @@ echo "<?php\n";
public function action
<?=
Inflector
::
id2camel
(
trim
(
basename
(
$generator
->
viewName
),
'_'
))
?>
()
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(Yii::$app->request->post())) {
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
if ($model->validate()) {
...
...
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