Skip to content

DDC-728: Inherited (JOINED) associations referred on DQL on owning side doesn't refer to correct table column #5240

doctrinebot opened this Issue Jul 30, 2010 · 4 comments

2 participants


Jira issue originally created by user @guilhermeblanco:

Based on code instrospection, it seems that SQL generated is wrong when you attempt to do something like this:

SELECT m FROM CompanyManager m WHERE m.InheritedSingleValuedAssociation = ?1

It seems the column that refers to the association points to wrong table (apparently it points to CompanyManager table).
If everything works, we still need to have coverage to it (we have none).


Comment created by romanb:

The first thing we need is tests to verify the issue.


Comment created by @beberlei:

I added a test to show that it works and no issue occours:

     * @group [DDC-728](
    public function testQueryForInheritedSingleValuedAssociation()
        $manager = new CompanyManager();

        $person = new CompanyPerson();



        $dql = "SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m WHERE m.spouse = ?1";
        $dqlManager = $this->_em->createQuery($dql)->setParameter(1, $person->getId())->getSingleResult();

        $this->assertEquals($manager->getId(), $dqlManager->getId());
        $this->assertEquals($person->getId(), $dqlManager->getSpouse()->getId());

Its in Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php, see commit:


Comment created by @guilhermeblanco:

I think I fixed it sometime... it was missing a condition that is now present.

Fixed. =)


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA4 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
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.