From 5c1c1d5f60252d305348bd48bd88e95bfb89ab8c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 13 Dec 2016 16:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3HasManyThrough=E5=85=B3?= =?UTF-8?q?=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/HasManyThrough.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/think/model/relation/HasManyThrough.php b/library/think/model/relation/HasManyThrough.php index 9339d505..56b90f4c 100644 --- a/library/think/model/relation/HasManyThrough.php +++ b/library/think/model/relation/HasManyThrough.php @@ -21,6 +21,8 @@ class HasManyThrough extends Relation { // 中间关联表外键 protected $throughKey; + // 中间表模型 + protected $through; /** * 架构函数 @@ -37,7 +39,7 @@ class HasManyThrough extends Relation { $this->parent = $parent; $this->model = $model; - $this->middle = $through; + $this->through = $through; $this->foreignKey = $foreignKey; $this->throughKey = $throughKey; $this->localKey = $localKey; @@ -90,7 +92,7 @@ class HasManyThrough extends Relation protected function baseQuery() { if (empty($this->baseQuery)) { - $through = $this->middle; + $through = $this->through; $model = $this->model; $alias = Loader::parseName(basename(str_replace('\\', '/', $model))); $throughTable = $through::getTable();