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
38476309
Commit
38476309
authored
Sep 10, 2014
by
Stephen Seliuk
Committed by
Alexander Makarov
Sep 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4971: Fixed hardcoded table names in `viaTable` expression in model generator
parent
00e4d63e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
CHANGELOG.md
extensions/gii/CHANGELOG.md
+1
-0
Generator.php
extensions/gii/generators/model/Generator.php
+2
-2
model.php
extensions/gii/generators/model/default/model.php
+1
-1
No files found.
extensions/gii/CHANGELOG.md
View file @
38476309
...
...
@@ -9,6 +9,7 @@ Yii Framework 2 gii extension Change Log
-
Bug #3265: Fixed incorrect controller class name validation (suralc)
-
Bug #3693: Fixed broken Gii preview when a file is unchanged (cebe)
-
Bug #4410: Fixed Gii to preserve database column order in generated _form.php (kmindi)
-
Bug #4971: Fixed hardcoded table names in
`viaTable`
expression in model generator (stepanselyuk)
-
Enh #2018: Search model is not required anymore in CRUD generator (johonunu)
-
Enh #3088: The gii module will manage their own URL rules now (qiangxue)
-
Enh #3222: Added
`useTablePrefix`
option to the model generator for Gii (horizons2)
...
...
extensions/gii/generators/model/Generator.php
View file @
38476309
...
...
@@ -354,7 +354,7 @@ class Generator extends \yii\gii\Generator
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
0
]
=>
$fks
[
$table
->
primaryKey
[
0
]][
1
]]);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className0
,
$db
->
getTableSchema
(
$table0
),
$table
->
primaryKey
[
1
],
true
);
$relations
[
$className0
][
$relationName
]
=
[
"return
\$
this->hasMany(
$className1
::className(),
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
"return
\$
this->hasMany(
$className1
::className(),
$link
)->viaTable('{
"
.
$this
->
generateTableName
(
$table
->
name
)
.
"
}',
$viaLink
);"
,
$className1
,
true
,
];
...
...
@@ -363,7 +363,7 @@ class Generator extends \yii\gii\Generator
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
1
]
=>
$fks
[
$table
->
primaryKey
[
1
]][
1
]]);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className1
,
$db
->
getTableSchema
(
$table1
),
$table
->
primaryKey
[
0
],
true
);
$relations
[
$className1
][
$relationName
]
=
[
"return
\$
this->hasMany(
$className0
::className(),
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
"return
\$
this->hasMany(
$className0
::className(),
$link
)->viaTable('{
"
.
$this
->
generateTableName
(
$table
->
name
)
.
"
}',
$viaLink
);"
,
$className0
,
true
,
];
...
...
extensions/gii/generators/model/default/model.php
View file @
38476309
...
...
@@ -20,7 +20,7 @@ namespace <?= $generator->ns ?>;
use Yii;
/**
* This is the model class for table "
<?=
$
tableName
?>
".
* This is the model class for table "
<?=
$
generator
->
generateTableName
(
$tableName
)
?>
".
*
<?php
foreach
(
$tableSchema
->
columns
as
$column
)
:
?>
* @property
<?=
"
{
$column
->
phpType
}
\$
{
$column
->
name
}
\n
"
?>
...
...
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