3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\ORM\UnitOfWork;
8 require_once __DIR__ . '/../../../TestInit.php';
13 class DDC1514Test extends \Doctrine\Tests\OrmFunctionalTestCase
15 protected function setUp()
20 $this->_schemaTool->createSchema(array(
21 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityA'),
22 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityB'),
23 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1514EntityC'),
25 } catch (\Exception $ignored) {
29 public function testIssue()
31 $a1 = new DDC1514EntityA();
34 $a2 = new DDC1514EntityA();
37 $b1 = new DDC1514EntityB();
38 $b1->entityAFrom = $a1;
41 $b2 = new DDC1514EntityB();
42 $b2->entityAFrom = $a2;
45 $c = new DDC1514EntityC();
49 $this->_em->persist($a1);
50 $this->_em->persist($a2);
51 $this->_em->persist($b1);
52 $this->_em->persist($b2);
53 $this->_em->persist($c);
57 $dql = "SELECT a, b, ba, c FROM " . __NAMESPACE__ . "\DDC1514EntityA AS a LEFT JOIN a.entitiesB AS b LEFT JOIN b.entityATo AS ba LEFT JOIN a.entityC AS c";
58 $results = $this->_em->createQuery($dql)->getResult();
60 $this->assertEquals($c->title, $results[1]->entityC->title);
69 /** @Id @Column(type="integer") @GeneratedValue */
73 /** @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") */
75 /** @ManyToOne(targetEntity="DDC1514EntityC") */
78 public function __construct()
80 $this->entitiesB = new ArrayCollection();
89 /** @Id @Column(type="integer") @GeneratedValue */
93 * @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB")
97 * @ManyToOne(targetEntity="DDC1514EntityA")
107 /** @Id @Column(type="integer") @GeneratedValue */