Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the \Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker() method #11641

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/Query/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@
*/
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__

Check warning on line 207 in src/Query/Parser.php

View check run for this annotation

Codecov / codecov/patch

src/Query/Parser.php#L203-L207

Added lines #L203 - L207 were not covered by tests
);

$this->customOutputWalker = $className;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/ORM/Query/LanguageRecognitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading