From 6405c6813166f56cbbc3bd6605813e1fd9266ff0 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 19 Dec 2017 00:51:42 +0800 Subject: [PATCH] Update HasMany.php --- library/think/model/relation/HasMany.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/model/relation/HasMany.php b/library/think/model/relation/HasMany.php index b132ea83..cf50a97a 100644 --- a/library/think/model/relation/HasMany.php +++ b/library/think/model/relation/HasMany.php @@ -245,7 +245,7 @@ class HasMany extends Relation return $this->parent->db() ->alias($model) ->field($model . '.*') - ->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType) + ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType) ->group($relation . '.' . $this->foreignKey) ->having('count(' . $id . ')' . $operator . $count); } @@ -277,7 +277,7 @@ class HasMany extends Relation return $this->parent->db()->alias($model) ->field($fields) ->group($model . '.' . $this->localKey) - ->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) + ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) ->where($where); }