Skip to content

Commit

Permalink
DDC-728 - Verified with test that checking for an inherited single va…
Browse files Browse the repository at this point in the history
…lued association works
  • Loading branch information
beberlei committed Aug 8, 2010
1 parent a1bf4dc commit dcebc24
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
Expand Up @@ -325,4 +325,32 @@ public function testDeleteJoinTableRecords()

$this->assertNull($this->_em->find(get_class($employee1), $employee1Id));
}

/**
* @group DDC-728
*/
public function testQueryForInheritedSingleValuedAssociation()
{
$manager = new CompanyManager();
$manager->setName('gblanco');
$manager->setSalary(1234);
$manager->setTitle('Awesome!');
$manager->setDepartment('IT');

$person = new CompanyPerson();
$person->setName('spouse');

$manager->setSpouse($person);

$this->_em->persist($manager);
$this->_em->persist($person);
$this->_em->flush();
$this->_em->clear();

$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());
}
}

0 comments on commit dcebc24

Please sign in to comment.