1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Fix BC-break on delete queries with nasty workaround

The `v2.5.x` series of the ORM allowed to have DELETE DQLs without using
an alias, even though it didn't follow the grammar rules of the parser.
We fixed that issue on `v2.6.0` however that was a BC-breaking change
and lots of people were relying on this faulty behaviour.

This workaround fixes the BC-break, without even trying to be elegant.
In `v2.7.0.` we should raise a deprecation notice to notify people that
we'll drop that "feature" in `v3.0`.
This commit is contained in:
Luís Cobucci 2018-02-18 23:19:46 +01:00
parent ae6d80daab
commit f36470941c
No known key found for this signature in database
GPG Key ID: EC61C5F01750ED3C

View File

@ -22,6 +22,7 @@ namespace Doctrine\ORM\Query;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
use Doctrine\ORM\Query\AST\Functions; use Doctrine\ORM\Query\AST\Functions;
use function strpos;
/** /**
* An LL(*) recursive-descent parser for the context-free grammar of the Doctrine Query Language. * An LL(*) recursive-descent parser for the context-free grammar of the Doctrine Query Language.
@ -1280,7 +1281,9 @@ class Parser
$this->match(Lexer::T_AS); $this->match(Lexer::T_AS);
} }
$aliasIdentificationVariable = $this->AliasIdentificationVariable(); $aliasIdentificationVariable = $this->lexer->isNextToken(Lexer::T_IDENTIFIER)
? $this->AliasIdentificationVariable()
: 'alias_should_have_been_set';
$deleteClause->aliasIdentificationVariable = $aliasIdentificationVariable; $deleteClause->aliasIdentificationVariable = $aliasIdentificationVariable;
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName); $class = $this->em->getClassMetadata($deleteClause->abstractSchemaName);