X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FTicket%2FDDC1209Test.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FTicket%2FDDC1209Test.php;h=bddbbdf44058f1998cbe45eafe5a60bf1aad5f07;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fgalerie.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php new file mode 100644 index 0000000..bddbbdf --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php @@ -0,0 +1,125 @@ +_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1209_1'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1209_2'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1209_3') + )); + } catch(\Exception $e) { + } + } + + /** + * @group DDC-1209 + */ + public function testIdentifierCanHaveCustomType() + { + $this->_em->persist(new DDC1209_3()); + $this->_em->flush(); + } + + /** + * @group DDC-1209 + */ + public function testCompositeIdentifierCanHaveCustomType() + { + $future1 = new DDC1209_1(); + $this->_em->persist($future1); + + $this->_em->flush(); + + $future2 = new DDC1209_2($future1); + $this->_em->persist($future2); + + $this->_em->flush(); + } +} + +/** + * @Entity + */ +class DDC1209_1 +{ + /** + * @Id @GeneratedValue @Column(type="integer") + */ + private $id; + + public function getId() + { + return $this->id; + } +} + +/** + * @Entity + */ +class DDC1209_2 +{ + /** + * @Id + * @ManyToOne(targetEntity="DDC1209_1") + * @JoinColumn(referencedColumnName="id", nullable=false) + */ + private $future1; + /** + * @Id + * @Column(type="datetime", nullable=false) + */ + private $starting_datetime; + /** + * @Id + * @Column(type="datetime", nullable=false) + */ + private $during_datetime; + /** + * @Id + * @Column(type="datetime", nullable=false) + */ + private $ending_datetime; + + public function __construct(DDC1209_1 $future1) + { + $this->future1 = $future1; + $this->starting_datetime = new DateTime2(); + $this->during_datetime = new DateTime2(); + $this->ending_datetime = new DateTime2(); + } +} + +/** + * @Entity + */ +class DDC1209_3 +{ + /** + * @Id + * @Column(type="datetime", name="somedate") + */ + private $date; + + public function __construct() + { + $this->date = new DateTime2(); + } +} + +class DateTime2 extends \DateTime +{ + public function __toString() + { + return $this->format('Y'); + } +} \ No newline at end of file