From 77be5c8f5fd0dc67a97577e490c262e15a021a80 Mon Sep 17 00:00:00 2001 From: Humphrey Mugambi Date: Thu, 27 Apr 2023 11:54:42 +0300 Subject: [PATCH] Fix: TDBM issue in InnerResultIterator --- src/InnerResultIterator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/InnerResultIterator.php b/src/InnerResultIterator.php index 1af0c73f..8268c509 100644 --- a/src/InnerResultIterator.php +++ b/src/InnerResultIterator.php @@ -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; @@ -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; }