mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正
This commit is contained in:
@@ -370,10 +370,14 @@ class BelongsToMany extends Relation
|
||||
// 关联查询封装
|
||||
$tableName = $this->query->getTable();
|
||||
$relationFk = $this->query->getPk();
|
||||
return $this->query->field($tableName . '.*')
|
||||
->field(true, false, $table, 'pivot', 'pivot__')
|
||||
->join($table . ' pivot', 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk)
|
||||
->where($condition);
|
||||
$query = $this->query->field($tableName . '.*')
|
||||
->field(true, false, $table, 'pivot', 'pivot__');
|
||||
|
||||
if (empty($this->baseQuery)) {
|
||||
$query->join($table . ' pivot', 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk)
|
||||
->where($condition);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user