改进Relation类

This commit is contained in:
thinkphp
2016-05-23 17:16:43 +08:00
parent ff30a2133e
commit 03f49b8461

View File

@@ -72,6 +72,7 @@ class Relation
$relation = $this->parent->$name(); $relation = $this->parent->$name();
$foreignKey = $this->foreignKey; $foreignKey = $this->foreignKey;
$localKey = $this->localKey; $localKey = $this->localKey;
if ($relation instanceof Relation) {
// 判断关联类型执行查询 // 判断关联类型执行查询
switch ($this->type) { switch ($this->type) {
case self::HAS_ONE: case self::HAS_ONE:
@@ -107,6 +108,9 @@ class Relation
$result = $relation; $result = $relation;
} }
return $result; return $result;
} else {
return $relation;
}
} }
/** /**