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
f210ec82
Commit
f210ec82
authored
Apr 17, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3134 from joaorjose/dev
Typecast model Id so that urls don't break when using MongoDB object Id'...
parents
a42b80ec
831be938
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
Generator.php
extensions/gii/generators/crud/Generator.php
+10
-2
No files found.
extensions/gii/generators/crud/Generator.php
View file @
f210ec82
...
...
@@ -433,11 +433,19 @@ class Generator extends \yii\gii\Generator
$class
=
$this
->
modelClass
;
$pks
=
$class
::
primaryKey
();
if
(
count
(
$pks
)
===
1
)
{
return
"'id' =>
\$
model->
{
$pks
[
0
]
}
"
;
if
(
is_subclass_of
(
$class
,
'yii\mongodb\ActiveRecord'
))
{
return
"'id' => (string)
\$
model->
{
$pks
[
0
]
}
"
;
}
else
{
return
"'id' =>
\$
model->
{
$pks
[
0
]
}
"
;
}
}
else
{
$params
=
[];
foreach
(
$pks
as
$pk
)
{
$params
[]
=
"'
$pk
' =>
\$
model->
$pk
"
;
if
(
is_subclass_of
(
$class
,
'yii\mongodb\ActiveRecord'
))
{
$params
[]
=
"'
$pk
' => (string)
\$
model->
$pk
"
;
}
else
{
$params
[]
=
"'
$pk
' =>
\$
model->
$pk
"
;
}
}
return
implode
(
', '
,
$params
);
...
...
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