Commit e79af911 by Qiang Xue

ensure populateRelation() is called for lazy loading.

parent 9f857563
...@@ -238,7 +238,8 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface ...@@ -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\"."); 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; return $value;
} }
......
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