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:
parent
ae6d80daab
commit
f36470941c
@ -22,6 +22,7 @@ namespace Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\Query\AST\Functions;
|
||||
use function strpos;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
$aliasIdentificationVariable = $this->AliasIdentificationVariable();
|
||||
$aliasIdentificationVariable = $this->lexer->isNextToken(Lexer::T_IDENTIFIER)
|
||||
? $this->AliasIdentificationVariable()
|
||||
: 'alias_should_have_been_set';
|
||||
|
||||
$deleteClause->aliasIdentificationVariable = $aliasIdentificationVariable;
|
||||
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user