mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[Syntax Error] line 0, col 28: Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '(' #6004
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 @dancostinel on GitHub (Jun 29, 2018).
Bug Report
Summary
Having this dql code:
Current behavior
When executing the query, it throws this error:
https://imgur.com/a/Odx0HJE
Seems like writing COALESCE function inside GROUP_CONCAT function is not working, even though I have the
CoalesceExpression()method insidevendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.phpclass.How to reproduce
added DQL code above
If I write the equivalent SQL code inside the repo's method, then it works as expected.
Please, help.
@Ocramius commented on GitHub (Jun 29, 2018):
As mentioned in the code, following is expected as parameter:
$this->ScalarExpression();A
CoalesceExpressionis aNullComparisonExpression, which in turn is aSimpleConditionalExpression, which is aConditionalPrimary, which is aConditionalFactor, which is aConditionalTerm, which is aConditionalExpression, which is really only used in the usualWHERE,JOIN,HAVINGsuspects (see https://github.com/doctrine/doctrine2/blob/v2.6.1/lib/Doctrine/ORM/Query/Parser.php) that is not guaranteed to return a scalar, from what I seeWe could change
COALESCE()to become a custom DQL function instead of a part of the DQL language, but that's going to break a lot of existing software.@Ocramius commented on GitHub (Jun 29, 2018):
Also, can you check the ORM version from your
composer.lockplease?~1.2seems incorrect.@dancostinel commented on GitHub (Jun 29, 2018):
Hi, thanks for replying.
Sure, the Doctrine/ORM version is (composer.lock):
And in composer.json (all entries related to doctrine):
I guess I miss-wrote the version by copying it from doctrine-bundle. Sorry about that.
@Ocramius commented on GitHub (Jun 29, 2018):
I think that's a version constraint only - it should be pin-pointed to a specific release, not to a range, please check again.
@dancostinel commented on GitHub (Jun 29, 2018):
Should be this one?
@Ocramius commented on GitHub (Jun 29, 2018):
Hmm,
v2.5.14.We changed some of the parsing in
2.6.0- can you attempt an upgrade please?@dancostinel commented on GitHub (Jun 29, 2018):
Ok, thanks for suggestion. I'll upgrade and let you know if it worked or not.
@dancostinel commented on GitHub (Jun 29, 2018):
Unfortunately the error is still present:
https://imgur.com/a/Ngt2xFB
Current setup:
composer.json
composer.lock
@Majkl578 commented on GitHub (Jul 11, 2018):
@dancostinel Can you please provide the code of your GROUP_CONCAT function? Or at least which library do you use that adds its implementation?
Assuming you use the popular
beberlei/DoctrineExtensions, the provided syntax is invalid:should be:
If you are using another library with different syntax, this may also be fixed by https://github.com/doctrine/doctrine2/pull/7296, but I can't confirm without the code - can you test 2.6.2-dev and see if the fix also fixes your issue?
Thanks.
@dancostinel commented on GitHub (Jul 12, 2018):
Hi @Majkl578 , that was just a typo in my code. You can figure out that easily, just by seeing the image with the error I received, which is for a different type of parenthesis (open-paranthesis), versus the type of parenthesis from my typo. Of course, I used DoctrineExtensions provided implementation for GROUP_CONCAT.
I'll present code again which displays the error:
If I remove the COALESCE part, which is:
then everything works as expected.
@Majkl578 commented on GitHub (Jul 12, 2018):
Can you please test with
doctrine/orm:2.6.x-dev?@Majkl578 commented on GitHub (Jul 12, 2018):
I did some further testing and this doesn't seem to have been supported by
GROUP_CONCAT.Furthermore this is not an ORM issue itself, it should be reported as a feature request / bug on beberlei/DoctrineExtensions.
As a proof, here's a diff for DoctrineExtensions with a test:
Fails with all of ORM 2.4.4, ORM 2.5.5, ORM 2.5.x-dev and ORM 2.6.x-dev.
You can also use
IFNULLwhich seems to work:Closing as invalid here, please open issue on DoctrineExtensions.
@dancostinel commented on GitHub (Jul 12, 2018):
Ok, @Majkl578,
IFNULLworks for me aswell. Thanks for the effort. I will report this issue to DoctrineExtensions' page.