-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DDC-3609] Syntax error in class table inheritance join when WITH is used in DQL query #1328
base: old-prototype-3.x
Are you sure you want to change the base?
Conversation
…ance join when WITH is used in DQL query) See: http://www.doctrine-project.org/jira/browse/DDC-3609
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3610 We use Jira to track the state of pull requests and the versions they got |
LEFT JOIN ComplexOrder.deliveryLocations ComplexDeliveryLocation | ||
|
||
WHERE | ||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you simplify the query to the minimal example making it crash?
@Ocramius - I believe this is the simplest query, the unusual behavior only appears when joining multiple tables that are used with class table inheritance. Two consecutive "ON" statements appear in the generated query, which mysql and postgres both seem fine with, but sqlite does not handle. |
@adeanzan I was wondering if it can be reproduced with a single entity joining on itself, for example |
@Ocramius - I appreciate you looking into this. I've added several more test cases and attempted to simplify them as much as possible to illustrate what's going on.
|
Could you please check if this is the same as http://www.doctrine-project.org/jira/browse/DDC-3697 and/or whether #1395 fixes it? |
ping @adeanzan, your feedback would be helpful. |
@mpdude - The problem does sound similar, although the tests are still failing with the same problem. I've just pushed some changes to make it compatible with your recent commit to disallow leading backslashes in FQCNs. I then ran the tests in your branch via:
It looks like the same issue is still there since the generated query looks like:
Thanks for looking into this and let me know if there's anything else I can do to assist. |
|
||
FROM | ||
Doctrine\Tests\ORM\Functional\Ticket\DDC3609Order BaseOrder | ||
LEFT JOIN Doctrine\Tests\ORM\Functional\Ticket\DDC3609SimpleOrder SimpleOrder WITH SimpleOrder.id = BaseOrder.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this query is correct or makes sense. You probably want to do
"SELECT SimpleOrder
FROM ".__NAMESPACE__."\DDC3609SimpleOrder SimpleOrder
WHERE SimpleOrder.fulfiller = 'FulfillerUser'"
here? That seems to work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right for normal use, however testCanFindSimpleOrderByChildField
and testCanFindComplexOrder
were added to break down the failing query a bit more to help with debugging. The query in testIssue
is the real use case.
To be clear, my goal is to get a result set of SimpleOrder
s and ComplexOrder
s where the fulfiller is 'FulfillerUser`. Since these objects both have the concept of a fulfiller (even though they store it via different relationships) I'd like to do this in a single query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At that point probably someone else who knows Doctrine better than me should help. I don't know if what you're trying to do is possible at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, I appreciate you looking into this issue!
I've added a test case to reproduce this issue. It's a bit contrived, but hopefully gives you enough to go on.