From 946845e0f4586806dca7f80cb03f19f058850292 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 23 Jun 2017 14:48:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/BelongsToMany.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/think/model/relation/BelongsToMany.php b/library/think/model/relation/BelongsToMany.php index 71ab4266..ef08abb4 100644 --- a/library/think/model/relation/BelongsToMany.php +++ b/library/think/model/relation/BelongsToMany.php @@ -105,9 +105,8 @@ class BelongsToMany extends Relation { $foreignKey = $this->foreignKey; $localKey = $this->localKey; - $middle = $this->middle; + $pk = $this->parent->getPk(); // 关联查询 - $pk = $this->parent->getPk(); $condition['pivot.' . $localKey] = $this->parent->$pk; return $this->belongsToManyQuery($foreignKey, $localKey, $condition); }