Skip to content

Commit

Permalink
Fix: TDBM issue in InnerResultIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
mugash authored and homersimpsons committed Apr 27, 2023
1 parent 832a446 commit 77be5c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/InnerResultIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace TheCodingMachine\TDBM;

use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Statement;
Expand Down Expand Up @@ -135,7 +136,7 @@ public function count()

if ($this->fetchStarted && $this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform) {
// Optimisation: we don't need a separate "count" SQL request in MySQL.
assert($this->statement instanceof Statement);
assert($this->statement instanceof Statement || $this->statement instanceof Result);
$this->count = (int)$this->statement->rowCount();
return $this->count;
}
Expand Down

0 comments on commit 77be5c8

Please sign in to comment.