Skip to content

Commit 6d8bcc8

Browse files
committed
修正聚合查询
1 parent 843f985 commit 6d8bcc8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/model/relation/BelongsTo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
100100
return $this->query
101101
->whereExp($this->localKey, '=' . $this->parent->getTable(true) . '.' . $this->foreignKey)
102102
->fetchSql()
103-
->$aggregate($this->localKey);
103+
->$aggregate($field);
104104
}
105105

106106
/**

src/model/relation/HasMany.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
183183
return $this->query->alias($aggregate . '_table')
184184
->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable(true) . '.' . $this->localKey)
185185
->fetchSql()
186-
->$aggregate($this->localKey);
186+
->$aggregate($field);
187187
}
188188

189189
/**

src/model/relation/HasOne.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
100100
return $this->query
101101
->whereExp($this->foreignKey, '=' . $this->parent->getTable(true) . '.' . $this->localKey)
102102
->fetchSql()
103-
->$aggregate($this->localKey);
103+
->$aggregate($field);
104104
}
105105

106106
/**

0 commit comments

Comments
 (0)