1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Added more tests for DQL joining the primary key entity and querying other fields

This commit is contained in:
Benjamin Eberlei 2010-08-08 19:46:45 +02:00
parent 7b07a17886
commit db936035e0

View File

@ -62,7 +62,22 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->clear();
$dql = "SELECT r, s FROM ".__NAMESPACE__."\DDC117Reference r JOIN r.source s WHERE r.source = ?1";
$ref = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult();
$dqlRef = $this->_em->createQuery($dql)->setParameter(1, 1)->getSingleResult();
$this->assertType(__NAMESPACE__."\DDC117Reference", $mapRef);
$this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->target());
$this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->source());
$this->assertSame($dqlRef, $this->_em->find(__NAMESPACE__."\DDC117Reference", $idCriteria));
$this->_em->clear();
$dql = "SELECT r, s FROM ".__NAMESPACE__."\DDC117Reference r JOIN r.source s WHERE s.title = ?1";
$dqlRef = $this->_em->createQuery($dql)->setParameter(1, 'Foo')->getSingleResult();
$this->assertType(__NAMESPACE__."\DDC117Reference", $mapRef);
$this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->target());
$this->assertType(__NAMESPACE__."\DDC117Article", $mapRef->source());
$this->assertSame($dqlRef, $this->_em->find(__NAMESPACE__."\DDC117Reference", $idCriteria));
}
/**