From e3b2d9212b35bd526468f753ccd16324ff28aa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 7 Mar 2023 13:06:35 +0100 Subject: [PATCH] Address deprecation of fetchAll() The methods Connection::fetchAll() and Result::fetchAll() have been deprecated in favor of more their precise counterparts. --- docs/en/reference/dql-doctrine-query-language.rst | 3 +-- .../ORM/Functional/AbstractManyToManyAssociationTestCase.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/en/reference/dql-doctrine-query-language.rst b/docs/en/reference/dql-doctrine-query-language.rst index 024d1b38f77..140d558b336 100644 --- a/docs/en/reference/dql-doctrine-query-language.rst +++ b/docs/en/reference/dql-doctrine-query-language.rst @@ -1304,14 +1304,13 @@ creating a class which extends ``AbstractHydrator``: _stmt->fetchAll(FetchMode::FETCH_ASSOC); + return $this->_stmt->fetchAllAssociative(); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php b/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php index fb497deea6a..b8aae160788 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php @@ -36,7 +36,7 @@ public function assertForeignKeysNotContain($firstId, $secondId): void protected function countForeignKeys($firstId, $secondId): int { - return count($this->_em->getConnection()->executeQuery(sprintf( + return count($this->_em->getConnection()->fetchAllAssociative(sprintf( <<<'SQL' SELECT %s FROM %s @@ -48,7 +48,7 @@ protected function countForeignKeys($firstId, $secondId): int $this->table, $this->firstField, $this->secondField - ), [$firstId, $secondId])->fetchAll()); + ), [$firstId, $secondId])); } public function assertCollectionEquals(Collection $first, Collection $second): bool