diff --git a/UPGRADE.md b/UPGRADE.md index e20a8fef89b..1819fe0aa0e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -5,6 +5,12 @@ Use of the PARTIAL keyword is not deprecated anymore in DQL when used with a hydrator that is not creating entities, such as the ArrayHydrator. +## Deprecate `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()` + +Use the `\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER` query hint to set the output walker +class instead of setting it through the `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()` method +on the parser instance. + # Upgrade to 2.19 ## Deprecate calling `ClassMetadata::getAssociationMappedByTargetField()` with the owning side of an association diff --git a/src/Query/Parser.php b/src/Query/Parser.php index a76cd4e45a6..057a5a2c6d4 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -200,6 +200,13 @@ public function __construct(Query $query) */ public function setCustomOutputTreeWalker($className) { + Deprecation::trigger( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/11641', + '%s is deprecated, set the output walker class with the \Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER query hint instead', + __METHOD__ + ); + $this->customOutputWalker = $className; } diff --git a/tests/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Tests/ORM/Query/LanguageRecognitionTest.php index a2e0e600969..37aac27f260 100644 --- a/tests/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Tests/ORM/Query/LanguageRecognitionTest.php @@ -51,7 +51,7 @@ public function parseDql(string $dql, array $hints = []): ParserResult $parser = new Query\Parser($query); // We do NOT test SQL output here. That only unnecessarily slows down the tests! - $parser->setCustomOutputTreeWalker(NullSqlWalker::class); + $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, NullSqlWalker::class); return $parser->parse(); }