From 224ab7b0fa8aa19fae28e82c2064fbff196155ff Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 29 Aug 2016 15:59:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84has?= =?UTF-8?q?=E5=92=8ChasWhere=E6=96=B9=E6=B3=95=E5=AF=B9join=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index f56aee93..988012ea 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1136,7 +1136,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess switch ($info['type']) { case Relation::HAS_MANY: return $model->db()->alias('a') - ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey']) + ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'], $info['joinType']) ->group('b.' . $info['foreignKey']) ->having('count(' . $id . ')' . $operator . $count); case Relation::HAS_MANY_THROUGH: @@ -1169,7 +1169,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } return $model->db()->alias('a') ->field('a.*') - ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey']) + ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'], $info['joinType']) ->where($where); case Relation::HAS_MANY_THROUGH: // TODO