Skip to content

Commit 723052c

Browse files
committed
#25 - Remove ORDER BY clause in COUNT(*) queries
1 parent 0779c00 commit 723052c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/TgDatabase/Criterion/QueryImpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ public function list($throwException = FALSE) {
206206
*/
207207
public function count($throwException = FALSE) {
208208
$query = $this->clone()->select(Projections::alias(Projections::rowCount(), 'cnt'))->setResultClass(NULL);
209+
// Remove all ORDER clauses
210+
$query->orders = array();
209211
$record = $query->first();
210212
if ($query->hasError()) {
211213
if ($throwException) {

0 commit comments

Comments
 (0)