|
@@ -0,0 +1,180 @@
|
|
1
|
+<?php
|
|
2
|
+
|
|
3
|
+namespace Muzich\CoreBundle\Entity;
|
|
4
|
+
|
|
5
|
+use Doctrine\ORM\Mapping as ORM;
|
|
6
|
+use Gedmo\Mapping\Annotation as Gedmo;
|
|
7
|
+use Symfony\Component\Validator\Constraints as Assert;
|
|
8
|
+use Muzich\CoreBundle\Validator as MuzichAssert;
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ * Cette table permet aux utilisateurs de proposer des tags sur des éléments
|
|
12
|
+ * ne leurs appartenant pas.
|
|
13
|
+ *
|
|
14
|
+ * @ORM\Entity
|
|
15
|
+ * @ORM\Entity(repositoryClass="Muzich\CoreBundle\Repository\ElementTagsProposition")
|
|
16
|
+ *
|
|
17
|
+ */
|
|
18
|
+class ElementTagsProposition
|
|
19
|
+{
|
|
20
|
+
|
|
21
|
+ /**
|
|
22
|
+ * @ORM\Id
|
|
23
|
+ * @ORM\Column(type="integer")
|
|
24
|
+ * @ORM\GeneratedValue(strategy="AUTO")
|
|
25
|
+ * @var type int
|
|
26
|
+ */
|
|
27
|
+ protected $id;
|
|
28
|
+
|
|
29
|
+ /**
|
|
30
|
+ * Propriétaire de la proposition
|
|
31
|
+ *
|
|
32
|
+ * @ORM\ManyToOne(targetEntity="User", inversedBy="element_tags_propositions")
|
|
33
|
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
|
34
|
+ */
|
|
35
|
+ protected $user;
|
|
36
|
+
|
|
37
|
+ /**
|
|
38
|
+ * Propriétaire de la proposition
|
|
39
|
+ *
|
|
40
|
+ * @ORM\ManyToOne(targetEntity="Element", inversedBy="tags_propositions")
|
|
41
|
+ * @ORM\JoinColumn(name="element_id", referencedColumnName="id")
|
|
42
|
+ */
|
|
43
|
+ protected $element;
|
|
44
|
+
|
|
45
|
+ /**
|
|
46
|
+ * Cet attribut stocke la liste des tags liés a cette proposition.
|
|
47
|
+ *
|
|
48
|
+ * @ORM\ManyToMany(targetEntity="Tag", inversedBy="propositions")
|
|
49
|
+ * @ORM\JoinTable(name="element_tags_proposition_tags_rel")
|
|
50
|
+ * @MuzichAssert\Tags()
|
|
51
|
+ */
|
|
52
|
+ protected $tags;
|
|
53
|
+
|
|
54
|
+ /**
|
|
55
|
+ * @var datetime $created
|
|
56
|
+ *
|
|
57
|
+ * @Gedmo\Timestampable(on="create")
|
|
58
|
+ * @ORM\Column(type="datetime")
|
|
59
|
+ */
|
|
60
|
+ private $created;
|
|
61
|
+
|
|
62
|
+ /**
|
|
63
|
+ * @var datetime $updated
|
|
64
|
+ *
|
|
65
|
+ * @ORM\Column(type="datetime")
|
|
66
|
+ * @Gedmo\Timestampable(on="update")
|
|
67
|
+ */
|
|
68
|
+ private $updated;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+ /**
|
|
72
|
+ * Get id
|
|
73
|
+ *
|
|
74
|
+ * @return integer
|
|
75
|
+ */
|
|
76
|
+ public function getId()
|
|
77
|
+ {
|
|
78
|
+ return $this->id;
|
|
79
|
+ }
|
|
80
|
+
|
|
81
|
+ /**
|
|
82
|
+ * Set created
|
|
83
|
+ *
|
|
84
|
+ * @param datetime $created
|
|
85
|
+ */
|
|
86
|
+ public function setCreated($created)
|
|
87
|
+ {
|
|
88
|
+ $this->created = $created;
|
|
89
|
+ }
|
|
90
|
+
|
|
91
|
+ /**
|
|
92
|
+ * Get created
|
|
93
|
+ *
|
|
94
|
+ * @return datetime
|
|
95
|
+ */
|
|
96
|
+ public function getCreated()
|
|
97
|
+ {
|
|
98
|
+ return $this->created;
|
|
99
|
+ }
|
|
100
|
+
|
|
101
|
+ /**
|
|
102
|
+ * Set updated
|
|
103
|
+ *
|
|
104
|
+ * @param datetime $updated
|
|
105
|
+ */
|
|
106
|
+ public function setUpdated($updated)
|
|
107
|
+ {
|
|
108
|
+ $this->updated = $updated;
|
|
109
|
+ }
|
|
110
|
+
|
|
111
|
+ /**
|
|
112
|
+ * Get updated
|
|
113
|
+ *
|
|
114
|
+ * @return datetime
|
|
115
|
+ */
|
|
116
|
+ public function getUpdated()
|
|
117
|
+ {
|
|
118
|
+ return $this->updated;
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ /**
|
|
122
|
+ * Set user
|
|
123
|
+ *
|
|
124
|
+ * @param Muzich\CoreBundle\Entity\User $user
|
|
125
|
+ */
|
|
126
|
+ public function setUser(\Muzich\CoreBundle\Entity\User $user)
|
|
127
|
+ {
|
|
128
|
+ $this->user = $user;
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ /**
|
|
132
|
+ * Get user
|
|
133
|
+ *
|
|
134
|
+ * @return Muzich\CoreBundle\Entity\User
|
|
135
|
+ */
|
|
136
|
+ public function getUser()
|
|
137
|
+ {
|
|
138
|
+ return $this->user;
|
|
139
|
+ }
|
|
140
|
+
|
|
141
|
+ /**
|
|
142
|
+ * Set element
|
|
143
|
+ *
|
|
144
|
+ * @param Muzich\CoreBundle\Entity\Element $element
|
|
145
|
+ */
|
|
146
|
+ public function setElement(\Muzich\CoreBundle\Entity\Element $element)
|
|
147
|
+ {
|
|
148
|
+ $this->element = $element;
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ /**
|
|
152
|
+ * Get element
|
|
153
|
+ *
|
|
154
|
+ * @return Muzich\CoreBundle\Entity\Element
|
|
155
|
+ */
|
|
156
|
+ public function getElement()
|
|
157
|
+ {
|
|
158
|
+ return $this->element;
|
|
159
|
+ }
|
|
160
|
+
|
|
161
|
+ /**
|
|
162
|
+ * Add tags
|
|
163
|
+ *
|
|
164
|
+ * @param Muzich\CoreBundle\Entity\Tag $tags
|
|
165
|
+ */
|
|
166
|
+ public function addTag(\Muzich\CoreBundle\Entity\Tag $tags)
|
|
167
|
+ {
|
|
168
|
+ $this->tags[] = $tags;
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ /**
|
|
172
|
+ * Get tags
|
|
173
|
+ *
|
|
174
|
+ * @return Doctrine\Common\Collections\Collection
|
|
175
|
+ */
|
|
176
|
+ public function getTags()
|
|
177
|
+ {
|
|
178
|
+ return $this->tags;
|
|
179
|
+ }
|
|
180
|
+}
|