From 00b8bb0a714228f8ae899285dcc36b9d35ba6d57 Mon Sep 17 00:00:00 2001 From: Thomas Lallement Date: Thu, 24 Aug 2023 15:31:47 +0200 Subject: [PATCH 1/3] Update Parser.php --- lib/Doctrine/ORM/Query/Parser.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 7e69b4865d0..a8e28866ae4 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -1844,11 +1844,13 @@ public function JoinAssociationDeclaration() */ public function PartialObjectExpression() { - Deprecation::trigger( - 'doctrine/orm', - 'https://github.com/doctrine/orm/issues/8471', - 'PARTIAL syntax in DQL is deprecated.' - ); + if ($this->query === AbstractQuery::HYDRATE_OBJECT || $this->query === AbstractQuery::HYDRATE_SIMPLEOBJECT) { + Deprecation::trigger( + 'doctrine/orm', + 'https://github.com/doctrine/orm/issues/8471', + 'PARTIAL syntax for object hydration (mode HYDRATE_OBJECT or HYDRATE_SIMPLEOBJECT) in DQL is deprecated.' + ); + } $this->match(Lexer::T_PARTIAL); From a805537128ed38b8c09234f4e72a56192a95cdaf Mon Sep 17 00:00:00 2001 From: Thomas Lallement Date: Thu, 24 Aug 2023 16:55:58 +0200 Subject: [PATCH 2/3] Fix missing use --- lib/Doctrine/ORM/Query/Parser.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index a8e28866ae4..7429856aed0 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -6,6 +6,7 @@ use Doctrine\Common\Lexer\Token; use Doctrine\Deprecations\Deprecation; +use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query; From 8394cafd9ddfdf4336ac6ad129f4324d114b91c4 Mon Sep 17 00:00:00 2001 From: Thomas Lallement Date: Thu, 24 Aug 2023 17:11:42 +0200 Subject: [PATCH 3/3] Update Parser.php --- lib/Doctrine/ORM/Query/Parser.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 7429856aed0..633c9fa0db3 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -1845,11 +1845,13 @@ public function JoinAssociationDeclaration() */ public function PartialObjectExpression() { - if ($this->query === AbstractQuery::HYDRATE_OBJECT || $this->query === AbstractQuery::HYDRATE_SIMPLEOBJECT) { + $hydratationMode = $this->query->getHydrationMode(); + + if ($hydratationMode === AbstractQuery::HYDRATE_OBJECT || $hydratationMode === AbstractQuery::HYDRATE_SIMPLEOBJECT) { Deprecation::trigger( 'doctrine/orm', 'https://github.com/doctrine/orm/issues/8471', - 'PARTIAL syntax for object hydration (mode HYDRATE_OBJECT or HYDRATE_SIMPLEOBJECT) in DQL is deprecated.' + 'PARTIAL syntax in DQL is deprecated.' ); }