From 0515d32bdf7d004391a411124d2456da6614f9a7 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 6 Nov 2013 08:30:36 -0500 Subject: [PATCH] Fixes #1146: Gii generates wrong relation. --- extensions/gii/generators/model/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/gii/generators/model/Generator.php b/extensions/gii/generators/model/Generator.php index 99f2d38..4f628d7 100644 --- a/extensions/gii/generators/model/Generator.php +++ b/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, ];