Skip to content

Loading…

DDC-331: Select Field of Root on Child Dql Alias generates wrong SQL #4104

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user @beberlei:

In a Class Table Inheritance Scenario, when you select a field "c.name" on a dql alias c of a child entity, where the field is really "p.name" on the parent the DQL parser does not recognize this and does not change the sql table alias. Test-Case attached.

@doctrinebot

Comment created by @beberlei:

DQL is:

SELECT e.name FROM Doctrine\Tests\Models\Company\CompanyEmployee e

SQL is:

SELECT c0*.name AS name0, c1_.discr AS discr1 FROM company_employees c0_ INNER JOIN company_persons c1_ ON c0_.id = c1_.id LEFT JOIN company_managers c2_ ON c0_.id = c2*.id

But should be:

SELECT **c1_**.name AS name0, c1*.discr AS discr1 FROM company_employees c0_ INNER JOIN company_persons c1_ ON c0_.id = c1_.id LEFT JOIN company_managers c2_ ON c0_.id = c2*.id
@doctrinebot

Comment created by @guilhermeblanco:

Added DDC-331 to core and provided test case is no longer valid.
Closing this ticket and committing the test case to prevent a possible BC break in the future.

@doctrinebot

Issue was closed with resolution "Cannot Reproduce"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.