diff --git a/ORM/LoggingHydratorTrait.php b/ORM/LoggingHydratorTrait.php index 80b68f1..8bc3ef0 100644 --- a/ORM/LoggingHydratorTrait.php +++ b/ORM/LoggingHydratorTrait.php @@ -33,9 +33,12 @@ trait LoggingHydratorTrait * * @return mixed[] */ - public function hydrateAll(/* Result */$stmt, /*ResultSetMapping*/ $resultSetMapping, /*array*/ $hints = [])/*: Countable|array*/ + public function hydrateAll(Result $stmt, ResultSetMapping $resultSetMapping, array $hints = []): mixed { - if ($logger = $this->_em->getConfiguration()->getHydrationLogger()) { + // For ORM 2.0 and 3.0 compatibility + $entityManager = isset($this->em) ? $this->em : $this->_em; + + if ($logger = $entityManager->getConfiguration()->getHydrationLogger()) { $type = null; if ($this instanceof ObjectHydrator) { diff --git a/composer.json b/composer.json index 3bd6880..2daee73 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ ], "require": { "php": ">=8.0", - "doctrine/orm": "^2.19", + "doctrine/orm": "^2.19|^3.0", "doctrine/doctrine-bundle": "^2.11", "symfony/framework-bundle": "^5.4|^6.0|^7.0", "symfony/twig-bundle": "^5.4|^6.0|^7.0",