Skip to content

Commit cb4a933

Browse files
author
TCB13
committed
QueryBuilder::count() improvements.
1 parent 8f005fa commit cb4a933

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/QueryBuilder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public function getNormalizedFilters(): array
365365

366366
public function pipeline(array $pipeline, bool $beforeQueryBuilderPipeline = false): self
367367
{
368-
$this->customPipeline = new \stdClass();
368+
$this->customPipeline = new \stdClass();
369369
$this->customPipeline->beforeQb = $beforeQueryBuilderPipeline;
370370
$this->customPipeline->pipeline = $pipeline;
371371

@@ -460,9 +460,10 @@ public function count(): int
460460
{
461461
$this->count = ["\$count" => "count"];
462462
$result = $this->findAll()->toArray();
463-
if (empty($result)) {
463+
if (empty($result) || (isset($result[0]) && empty($result[0]))) {
464464
return 0;
465465
}
466+
466467
return $result[0]["count"];
467468
}
468469

0 commit comments

Comments
 (0)