Commit 64618176 by Qiang Xue

Fixes #2314: Gii model generator does not generate correct relation type in some special case

parent 0d92cb4a
......@@ -5,6 +5,7 @@ Yii Framework 2 gii extension Change Log
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Bug #2314: Gii model generator does not generate correct relation type in some special case (qiangxue)
- Bug #3265: Fixed incorrect controller class name validation (suralc)
- Bug #3693: Fixed broken Gii preview when a file is unchanged (cebe)
- Enh #2018: Search model is not required anymore in CRUD generator (johonunu)
......
......@@ -322,10 +322,14 @@ class Generator extends \yii\gii\Generator
// Add relation for the referenced table
$hasMany = false;
foreach ($fks as $key) {
if (!in_array($key, $table->primaryKey, true)) {
$hasMany = true;
break;
if (count($table->primaryKey) > count($fks)) {
$hasMany = true;
} else {
foreach ($fks as $key) {
if (!in_array($key, $table->primaryKey, true)) {
$hasMany = true;
break;
}
}
}
$link = $this->generateRelationLink($refs);
......
......@@ -5,6 +5,7 @@ Yii Framework 2 Change Log
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Bug #2314: Gii model generator does not generate correct relation type in some special case (qiangxue)
- Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
- Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
- Bug #2853: ActiveRecord did not handle resource-typed columns well (chris68, qiangxue)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment