Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / Ticket / DDC192Test.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5 require_once __DIR__ . '/../../../TestInit.php';
6
7 class DDC192Test extends \Doctrine\Tests\OrmFunctionalTestCase
8 {
9     public function testSchemaCreation()
10     {
11         $this->_schemaTool->createSchema(array(
12             $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC192User'),
13             $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC192Phonenumber')
14         ));
15     }
16 }
17
18
19 /**
20  * @Entity @Table(name="ddc192_users")
21  */
22 class DDC192User
23 {
24     /**
25      * @Id @Column(name="id", type="integer")
26      * @GeneratedValue(strategy="AUTO")
27      */
28     public $id;
29
30     /**
31      * @Column(name="name", type="string")
32      */
33     public $name;
34 }
35
36
37 /**
38  * @Entity @Table(name="ddc192_phonenumbers")
39  */
40 class DDC192Phonenumber
41 {
42     /**
43      * @Id @Column(name="phone", type="string", length=40)
44      */
45     protected $phone;
46
47     /**
48      * @Id
49      * @ManyToOne(targetEntity="DDC192User")
50      * @JoinColumn(name="userId", referencedColumnName="id")
51      */
52     protected $User;
53
54
55     public function setPhone($value) { $this->phone = $value; }
56
57     public function getPhone() { return $this->phone; }
58
59     public function setUser(User $user)
60     {
61         $this->User = $user;
62     }
63
64     public function getUser() { return $this->User; }
65 }