You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also tried to directly refer to the association instead of its ID field, like this:
'SELECT x
FROM \PathToTheEntityClass\SomeEntityClass x
WHERE x.someSingleValuedAssociation.anotherSingleValuedAssociation = :someObjectOfTheCorrespondingType'
So a SingleValuedAssociationPathExpression is defined to be an identification variable, followed by a dot, followed by a theoretically infinite series of association fields (i. e. relationship attributes), separated from each other by a dot.
I should be able to use this expression in a WhereClause, because a ComparisonExpression can contain a ConditionalExpression, which can contain an ArithmeticExpression, which can contain a SingleValuedPathExpression, which can be either a StateFieldPathExpr, or a SingleValuedAssociationPathExpression.
In effect this means that the user currently needs to do all but the most trivial joins manually, right?
The text was updated successfully, but these errors were encountered:
We removed support for this kind of queries since they considerably raised the complexity and runtime in the DQL parser. Use the Explicit join syntax please, the generated SQL would look the same anyways.
Jira issue originally created by user dalvarez:
I have a DQL query that is basically
'SELECT x
FROM \PathToTheEntityClass\SomeEntityClass x
WHERE x.someSingleValuedAssociation.anotherSingleValuedAssociation.id = :someID'
This query results in an exception being thrown, like the one shown below.
exception 'Doctrine\ORM\Query\QueryException' with message '[Syntax Error] line 0, col 112: Error: Expected =, <, <=, <>, >, >=, !=, got '.'' in /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/QueryException.php:42 Stack trace: #0 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(345): Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 112...') #1 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(2621): Doctrine\ORM\Query\Parser->syntaxError('=, <, <=, <>, >...') #2 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(2408): Doctrine\ORM\Query\Parser->ComparisonOperator() #3 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1947): Doctrine\ORM\Query\Parser->ComparisonExpression() #4 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1870): Doctrine\ORM\Query\Parser->SimpleConditionalExpression() #5 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1829): Doctrine\ORM\Query\Parser->ConditionalPrimary() #6 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1799): Doctrine\ORM\Query\Parser->ConditionalFactor() #7 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1775): Doctrine\ORM\Query\Parser->ConditionalTerm() #8 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(1163): Doctrine\ORM\Query\Parser->ConditionalExpression() #9 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(718): Doctrine\ORM\Query\Parser->WhereClause() #10 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(687): Doctrine\ORM\Query\Parser->SelectStatement() #11 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(202): Doctrine\ORM\Query\Parser->QueryLanguage() #12 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/Parser.php(273): Doctrine\ORM\Query\Parser->getAST() #13 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query.php(203): Doctrine\ORM\Query\Parser->parse() #14 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query.php(223): Doctrine\ORM\Query->_parse() #15 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/AbstractQuery.php(528): Doctrine\ORM\Query->_doExecute() #16 /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/AbstractQuery.php(366): Doctrine\ORM\AbstractQuery->execute(Array, 1) #17 /var/www/invoiceCreator/src/persistentData/DB.php(81): Doctrine\ORM\AbstractQuery->getResult() #18
I also tried to directly refer to the association instead of its ID field, like this:
'SELECT x
FROM \PathToTheEntityClass\SomeEntityClass x
WHERE x.someSingleValuedAssociation.anotherSingleValuedAssociation = :someObjectOfTheCorrespondingType'
This results in the same error.
I read the EBNF definition at http://www.doctrine-project.org/projects/orm/2.0/docs/reference/dql-doctrine-query-language/en#dql-doctrine-query-language, and if I am not missing something here, both queries should be legitimate. I think there is the problem with traversing more than one association in a path expression. The corresponding definition for the first expression within the WHERE clause is a SingleValuedAssociationPathExpression, defined as:
SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField
So a SingleValuedAssociationPathExpression is defined to be an identification variable, followed by a dot, followed by a theoretically infinite series of association fields (i. e. relationship attributes), separated from each other by a dot.
I should be able to use this expression in a WhereClause, because a ComparisonExpression can contain a ConditionalExpression, which can contain an ArithmeticExpression, which can contain a SingleValuedPathExpression, which can be either a StateFieldPathExpr, or a SingleValuedAssociationPathExpression.
In effect this means that the user currently needs to do all but the most trivial joins manually, right?
The text was updated successfully, but these errors were encountered: