修正关联一处问题

This commit is contained in:
thinkphp
2016-12-01 12:15:17 +08:00
parent 1afdde40e3
commit 7ef95130c1

View File

@@ -405,7 +405,7 @@ class Relation
$foreignKey = $this->foreignKey;
$localKey = $this->localKey;
// 预载入关联查询 支持嵌套预载入
$list = $this->belongsToManyQuery($model, $this->middle, $foreignKey, $localKey, $where)->with($subRelation)->select();
$list = $this->belongsToManyQuery($model->getQuery(), $this->middle, $foreignKey, $localKey, $where)->with($subRelation)->select();
// 组装模型数据
$data = [];