From c34a9153e3f42cd9d410ecd060258ebbc3c07617 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 21 May 2017 09:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=9C=E7=A8=8B=E4=B8=80?= =?UTF-8?q?=E5=AF=B9=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/HasManyThrough.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/think/model/relation/HasManyThrough.php b/library/think/model/relation/HasManyThrough.php index 7d0d5124..1573fc65 100644 --- a/library/think/model/relation/HasManyThrough.php +++ b/library/think/model/relation/HasManyThrough.php @@ -130,10 +130,9 @@ class HasManyThrough extends Relation { if (empty($this->baseQuery) && $this->parent->getData()) { $through = $this->through; - $model = $this->model; - $alias = Loader::parseName(basename(str_replace('\\', '/', $model))); + $alias = Loader::parseName(basename(str_replace('\\', '/', $this->model))); $throughTable = $through::getTable(); - $pk = (new $this->model)->getPk(); + $pk = (new $through)->getPk(); $throughKey = $this->throughKey; $modelTable = $this->parent->getTable(); $this->query->field($alias . '.*')->alias($alias)