改进Relation类的getRelation方法 支持在关联定义方法中使用where条件或者其他的操作Query操作方法

This commit is contained in:
thinkphp
2016-05-29 12:09:21 +08:00
parent 14de14a1eb
commit c9846a51e1

View File

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