Update BelongsTo.php

This commit is contained in:
Karson
2017-12-19 00:49:25 +08:00
committed by ThinkPHP
parent ac6a5c3ab5
commit d6da940d20

View File

@@ -102,7 +102,7 @@ class BelongsTo extends OneToOne
return $this->parent->db()->alias($model)
->field($fields)
->group($model . '.' . $this->foreignKey)
->join($table . ' ' . $relation, $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType)
->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType)
->where($where);
}