Browse Source

Fixes #1405: fixed disambiguation of relation names generated by gii.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
f473abe17f
  1. 4
      extensions/gii/generators/model/Generator.php

4
extensions/gii/generators/model/Generator.php

@ -397,10 +397,10 @@ class Generator extends \yii\gii\Generator
} }
$name = $rawName = Inflector::id2camel($key, '_'); $name = $rawName = Inflector::id2camel($key, '_');
$i = 0; $i = 0;
while (isset($table->columns[$name])) { while (isset($table->columns[lcfirst($name)])) {
$name = $rawName . ($i++); $name = $rawName . ($i++);
} }
while (isset($relations[$className][$name])) { while (isset($relations[$className][lcfirst($name)])) {
$name = $rawName . ($i++); $name = $rawName . ($i++);
} }

Loading…
Cancel
Save