Browse Source

Fixes #1146: Gii generates wrong relation.

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

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

@ -293,7 +293,7 @@ class Generator extends \yii\gii\Generator
$link = $this->generateRelationLink($refs);
$relationName = $this->generateRelationName($relations, $refClassName, $refTable, $className, $hasMany);
$relations[$refClassName][$relationName] = [
"return \$this->" . ($hasMany ? 'hasMany' : 'hasOne') . "($refClassName::className(), $link);",
"return \$this->" . ($hasMany ? 'hasMany' : 'hasOne') . "($className::className(), $link);",
$className,
$hasMany,
];

Loading…
Cancel
Save