From 7ef95130c195a3a76b8e7b7bedadd9f609f25ce2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 1 Dec 2016 12:15:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=B3=E8=81=94=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Relation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index 5bfd0773..21f68462 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -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 = [];