X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FTicket%2FDDC1300Test.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FTicket%2FDDC1300Test.php;h=38278dc1cd47e8fc42367a3b54bd2112bbf94dea;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1300Test.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1300Test.php new file mode 100644 index 0000000..38278dc --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1300Test.php @@ -0,0 +1,108 @@ +_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1300Foo'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1300FooLocale'), + )); + } + + public function testIssue() + { + $foo = new DDC1300Foo(); + $foo->_fooReference = "foo"; + + $this->_em->persist($foo); + $this->_em->flush(); + + $locale = new DDC1300FooLocale(); + $locale->_foo = $foo; + $locale->_locale = "en"; + $locale->_title = "blub"; + + $this->_em->persist($locale); + $this->_em->flush(); + + $query = $this->_em->createQuery('SELECT f, fl FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1300Foo f JOIN f._fooLocaleRefFoo fl'); + $result = $query->getResult(); + + $this->assertEquals(1, count($result)); + } +} + +/** + * @Entity + */ +class DDC1300Foo +{ + /** + * @var integer fooID + * @Column(name="fooID", type="integer", nullable=false) + * @GeneratedValue(strategy="AUTO") + * @Id + */ + public $_fooID = null; + + /** + * @var string fooReference + * @Column(name="fooReference", type="string", nullable=true, length=45) + */ + public $_fooReference = null; + + /** + * @OneToMany(targetEntity="DDC1300FooLocale", mappedBy="_foo", + * cascade={"persist"}) + */ + public $_fooLocaleRefFoo = null; + + /** + * Constructor + * + * @param array|Zend_Config|null $options + * @return Bug_Model_Foo + */ + public function __construct($options = null) + { + $this->_fooLocaleRefFoo = new \Doctrine\Common\Collections\ArrayCollection(); + } + +} + +/** + * @Entity + */ +class DDC1300FooLocale +{ + + /** + * @ManyToOne(targetEntity="DDC1300Foo") + * @JoinColumn(name="fooID", referencedColumnName="fooID") + * @Id + */ + public $_foo = null; + + /** + * @var string locale + * @Column(name="locale", type="string", nullable=false, length=5) + * @Id + */ + public $_locale = null; + + /** + * @var string title + * @Column(name="title", type="string", nullable=true, length=150) + */ + public $_title = null; + +} \ No newline at end of file