改进模型的appendRelationAttr方法

This commit is contained in:
thinkphp
2017-05-14 13:46:02 +08:00
parent 629a194211
commit 13a5a3d9b6

View File

@@ -661,10 +661,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$relation = Loader::parseName($relation, 1, false);
// 获取关联数据
if (isset($this->relation[$relation])) {
$model = $this->relation[$relation];
} else {
$model = $this->getAttr($relation);
$model = $this->getRelationData($this->$relation());
}
if ($model instanceof Model) {