Fixed parser rejecting valid DQL#7053
Conversation
|
@carnage can you still add a DQL SQL generation test? There's an already existing test class for that. |
|
Seems to fail tho: https://travis-ci.org/doctrine/doctrine2/jobs/339380152#L652 |
|
new test passes, fix breaks other tests. Will have to look into it further. Is there a BNF grammar defined for DQL? |
|
Dug into this some more. Seems the syntax "DELETE FROM \namespace\Entity" isn't legal according to the grammar. However, it was accepted as a valid statement in >2.6 and performed as expected. There are two possible options. |
|
@carnage thanks for your help on digging up things 👍 @Ocramius @guilhermeblanco it looks like this commit is the cause of this issue, which was actually a fix to ensure that the grammar is properly followed. That seems to be the most relevant change from I've managed to make the tests pass with a nasty gambiarra™ - which essentially consist in creating an alias when it doesn't exist. Although it's quite dirty, I'd suggest that we should remove the BC-break in For those wondering what's a gambiarra: it's a Brazilian word for a very creative and terrible solution. If that description is not enough, here's an image. |
…lt, so the test needs adaptation
Doctrine 2.5 allows the following as valid DQL:
"DELETE FROM Namespace\Entity"
Doctrine 2.6 rejects this as a syntax error.
The bug appears to be on the changed line, as the code didn't match the logic specified in the comment. I've not got a massive amount of knowledge on how the parser/lexer is built but changing this to a >= means that the above DQL is accepted as valid and appears to fix the problem.