From 145833658ceca99afa4bdba27bd106e356c67d4d Mon Sep 17 00:00:00 2001 From: Carnage Date: Fri, 9 Feb 2018 09:21:23 +0000 Subject: [PATCH 1/2] Fixed parser rejecting valid DQL --- lib/Doctrine/ORM/Query/Parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index e726aa062aa..ce1072a7ffd 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -315,7 +315,7 @@ public function match($token) } // If parameter is T_IDENTIFIER, then matches T_IDENTIFIER (100) and keywords (200+) - if ($token === Lexer::T_IDENTIFIER && $lookaheadType < Lexer::T_IDENTIFIER) { + if ($token === Lexer::T_IDENTIFIER && $lookaheadType >= Lexer::T_IDENTIFIER) { $this->syntaxError($this->lexer->getLiteral($token)); } } From 8ff12c2bd27e64c630175149bbd76a46c409bef9 Mon Sep 17 00:00:00 2001 From: Carnage Date: Fri, 9 Feb 2018 09:48:44 +0000 Subject: [PATCH 2/2] Adds sql generation test --- .../Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php index 8218339df35..a5cb8b9d816 100644 --- a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php @@ -36,6 +36,14 @@ public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) } } + public function testSupportsDeleteWithoutWhereAndAlias() + { + $this->assertSqlGeneration( + 'DELETE FROM Doctrine\Tests\Models\CMS\CmsUser', + 'DELETE FROM cms_users' + ); + } + public function testSupportsDeleteWithoutWhereAndFrom() { $this->assertSqlGeneration(