mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-12 03:30:12 +08:00
ensure populateRelation() is called for lazy loading.
This commit is contained in:
@@ -238,7 +238,8 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
||||
throw new InvalidParamException('Relation names are case sensitive. ' . get_class($this) . " has a relation named \"$realName\" instead of \"$name\".");
|
||||
}
|
||||
}
|
||||
return $this->_related[$name] = $value->multiple ? $value->all() : $value->one();
|
||||
$this->populateRelation($name, $value->multiple ? $value->all() : $value->one());
|
||||
return $this->_related[$name];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user