Update HasMany.php

This commit is contained in:
Karson
2017-12-19 00:51:42 +08:00
committed by ThinkPHP
parent a77e5d8ec8
commit 6405c68131

View File

@@ -245,7 +245,7 @@ class HasMany extends Relation
return $this->parent->db() return $this->parent->db()
->alias($model) ->alias($model)
->field($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) ->group($relation . '.' . $this->foreignKey)
->having('count(' . $id . ')' . $operator . $count); ->having('count(' . $id . ')' . $operator . $count);
} }
@@ -277,7 +277,7 @@ class HasMany extends Relation
return $this->parent->db()->alias($model) return $this->parent->db()->alias($model)
->field($fields) ->field($fields)
->group($model . '.' . $this->localKey) ->group($model . '.' . $this->localKey)
->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
->where($where); ->where($where);
} }