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
faed08e6
Commit
faed08e6
authored
Nov 11, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed crud to work with table that has no PK but AR defines one
parent
183a0bfa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
Generator.php
extensions/gii/generators/crud/Generator.php
+9
-3
No files found.
extensions/gii/generators/crud/Generator.php
View file @
faed08e6
...
@@ -341,7 +341,9 @@ class Generator extends \yii\gii\Generator
...
@@ -341,7 +341,9 @@ class Generator extends \yii\gii\Generator
public
function
generateUrlParams
()
public
function
generateUrlParams
()
{
{
$pks
=
$this
->
getTableSchema
()
->
primaryKey
;
/** @var ActiveRecord $class */
$class
=
$this
->
modelClass
;
$pks
=
$class
::
primaryKey
();
if
(
count
(
$pks
)
===
1
)
{
if
(
count
(
$pks
)
===
1
)
{
return
"'id' =>
\$
model->
{
$pks
[
0
]
}
"
;
return
"'id' =>
\$
model->
{
$pks
[
0
]
}
"
;
}
else
{
}
else
{
...
@@ -355,7 +357,9 @@ class Generator extends \yii\gii\Generator
...
@@ -355,7 +357,9 @@ class Generator extends \yii\gii\Generator
public
function
generateActionParams
()
public
function
generateActionParams
()
{
{
$pks
=
$this
->
getTableSchema
()
->
primaryKey
;
/** @var ActiveRecord $class */
$class
=
$this
->
modelClass
;
$pks
=
$class
::
primaryKey
();
if
(
count
(
$pks
)
===
1
)
{
if
(
count
(
$pks
)
===
1
)
{
return
'$id'
;
return
'$id'
;
}
else
{
}
else
{
...
@@ -366,7 +370,9 @@ class Generator extends \yii\gii\Generator
...
@@ -366,7 +370,9 @@ class Generator extends \yii\gii\Generator
public
function
generateActionParamComments
()
public
function
generateActionParamComments
()
{
{
$table
=
$this
->
getTableSchema
();
$table
=
$this
->
getTableSchema
();
$pks
=
$table
->
primaryKey
;
/** @var ActiveRecord $class */
$class
=
$this
->
modelClass
;
$pks
=
$class
::
primaryKey
();
if
(
count
(
$pks
)
===
1
)
{
if
(
count
(
$pks
)
===
1
)
{
return
[
'@param '
.
$table
->
columns
[
$pks
[
0
]]
->
phpType
.
' $id'
];
return
[
'@param '
.
$table
->
columns
[
$pks
[
0
]]
->
phpType
.
' $id'
];
}
else
{
}
else
{
...
...
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