Commit 0515d32b by Qiang Xue

Fixes #1146: Gii generates wrong relation.

parent b7990d3d
......@@ -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,
];
......
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