Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / Models / DDC117 / DDC117Article.php
1 <?php
2
3 namespace Doctrine\Tests\Models\DDC117;
4
5 /**
6  * @Entity
7  */
8 class DDC117Article
9 {
10     /** @Id @Column(type="integer", name="article_id") @GeneratedValue */
11     private $id;
12
13     /** @Column */
14     private $title;
15
16     /**
17      * @OneToMany(targetEntity="DDC117Reference", mappedBy="source", cascade={"remove"})
18      */
19     private $references;
20
21     /**
22      * @OneToOne(targetEntity="DDC117ArticleDetails", mappedBy="article", cascade={"persist", "remove"})
23      */
24     private $details;
25
26     /**
27      * @OneToMany(targetEntity="DDC117Translation", mappedBy="article", cascade={"persist", "remove"})
28      */
29     private $translations;
30
31     /**
32      * @OneToMany(targetEntity="DDC117Link", mappedBy="source")
33      */
34     private $links;
35
36     public function __construct($title)
37     {
38         $this->title = $title;
39         $this->references = new \Doctrine\Common\Collections\ArrayCollection();
40         $this->translations = new \Doctrine\Common\Collections\ArrayCollection();
41     }
42
43     public function setDetails($details)
44     {
45         $this->details = $details;
46     }
47
48     public function id()
49     {
50         return $this->id;
51     }
52
53     public function addReference($reference)
54     {
55         $this->references[] = $reference;
56     }
57
58     public function references()
59     {
60         return $this->references;
61     }
62
63     public function addTranslation($language, $title)
64     {
65         $this->translations[] = new DDC117Translation($this, $language, $title);
66     }
67
68     public function getText()
69     {
70         return $this->details->getText();
71     }
72
73     public function getDetails()
74     {
75         return $this->details;
76     }
77
78     public function resetText()
79     {
80         $this->details = null;
81     }
82
83     public function getTranslations()
84     {
85         return $this->translations;
86     }
87 }