mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3295: Detection of reserved words in DQL #4076
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 2, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user jaimz:
I don't know if the summary really explains much...
I wrote a query in DQL (using the query builder but I doubt that matters). The query is:
SELECT club FROM Domain\Groups\Roster roster INNER JOIN Domain\Club\Club club WITH club.roster = roster INNER JOIN Domain\Groups\GroupMember member WITH member.group = roster
This results in the error:
line #, col ###: Error: Expected Doctrine\ORM\Query\Lexer::T_MEMBER, got '='
It wasn't until I looked deep into the documentation that I can't name my entity "member" because it's a reserved word (I guess) in DQL for the MEMBER OF clause.
Is it possible to detect that the usage of it is as an entity name, not a comparison operator?
Is there anyway around this?
I could only imagine that I'm not the first person to have this issue, and I'm sure that there are other people out there with user systems that would like to use the word 'member'
Maybe the documentation should have a page that covers what words are 'reserved words'? (if there is a page that mentions them, I haven't seen it)
@doctrinebot commented on GitHub (Sep 2, 2014):
Issue was closed with resolution "Can't Fix"
@doctrinebot commented on GitHub (Sep 2, 2014):
Comment created by @ocramius:
We have an EBNF at http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#ebnf, where all DQL symbols are listed.
We can't solve this sort of issue in 2.x as it would require a rewrite of the parser/lexer.