1 | <?php |
||
14 | class Notification |
||
15 | { |
||
16 | /** |
||
17 | * @ORM\Id |
||
18 | * @ORM\Column(type="integer") |
||
19 | * @ORM\GeneratedValue(strategy="AUTO") |
||
20 | */ |
||
21 | protected $id; |
||
22 | |||
23 | /** |
||
24 | * Date |
||
25 | * @ORM\Column(name="date", type="integer") |
||
26 | * @JMS\Expose |
||
27 | * @Assert\Type("integer") |
||
28 | */ |
||
29 | protected $date; |
||
30 | |||
31 | /** |
||
32 | * Raison d'envoi (string unique) |
||
33 | * @ORM\Column(name="reason", type="string") |
||
34 | * @JMS\Expose |
||
35 | * @Assert\Type("string") |
||
36 | */ |
||
37 | protected $reason; |
||
38 | |||
39 | /** |
||
40 | * Titre |
||
41 | * @ORM\Column(name="title", type="string") |
||
42 | * @JMS\Expose |
||
43 | * @Assert\Type("string") |
||
44 | */ |
||
45 | protected $title; |
||
46 | |||
47 | /** |
||
48 | * Message |
||
49 | * @ORM\Column(name="message", type="string") |
||
50 | * @JMS\Expose |
||
51 | * @Assert\Type("string") |
||
52 | */ |
||
53 | protected $message; |
||
54 | |||
55 | /** |
||
56 | * Ressource : lien éventuel vers l'objet de la notification |
||
57 | * @ORM\Column(name="resource", type="string") |
||
58 | * @JMS\Expose |
||
59 | * @Assert\Type("string") |
||
60 | */ |
||
61 | protected $resource; |
||
62 | |||
63 | /** |
||
64 | * Mode d'envoi (to|exclude) |
||
65 | * @ORM\Column(name="mode", type="string") |
||
66 | * @JMS\Expose |
||
67 | * @Assert\Type("string") |
||
68 | */ |
||
69 | protected $mode; |
||
70 | |||
71 | /** |
||
72 | * Destinataire(s) ou liste d'exclusion suivant le mode d'envoi choisi |
||
73 | * @ORM\ManyToMany(targetEntity="KI\UserBundle\Entity\User", inversedBy="notifications") |
||
74 | * @ORM\JoinTable(name="notifications_recipient", |
||
75 | * joinColumns={@ORM\JoinColumn(name="notifications_id", referencedColumnName="id", onDelete="cascade")}, |
||
76 | * inverseJoinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="cascade")} |
||
77 | * ) |
||
78 | */ |
||
79 | protected $recipients; |
||
80 | |||
81 | /** |
||
82 | * Personnes ayant lu la notification |
||
83 | * @ORM\ManyToMany(targetEntity="KI\UserBundle\Entity\User", inversedBy="notificationsRead") |
||
84 | * @ORM\JoinTable(name="notifications_read", |
||
85 | * joinColumns={@ORM\JoinColumn(name="notification_id", referencedColumnName="id", onDelete="cascade")}, |
||
86 | * inverseJoinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="cascade")} |
||
87 | * ) |
||
88 | */ |
||
89 | protected $reads; |
||
90 | |||
91 | |||
92 | |||
93 | |||
94 | |||
95 | |||
96 | |||
97 | //===== GENERATED AUTOMATICALLY =====// |
||
98 | |||
99 | /** |
||
100 | * Constructor |
||
101 | */ |
||
102 | public function __construct($reason, $title, $message, $mode = 'to', $resource = '') |
||
114 | |||
115 | /** |
||
116 | * Get id |
||
117 | * |
||
118 | * @return integer |
||
119 | */ |
||
120 | public function getId() |
||
124 | |||
125 | /** |
||
126 | * Set date |
||
127 | * |
||
128 | * @param integer $date |
||
129 | * @return Newsitem |
||
130 | */ |
||
131 | public function setDate($date) |
||
137 | |||
138 | /** |
||
139 | * Get date |
||
140 | * |
||
141 | * @return integer |
||
142 | */ |
||
143 | public function getDate() |
||
147 | |||
148 | /** |
||
149 | * Set reason |
||
150 | * |
||
151 | * @param string $reason |
||
152 | * @return Notification |
||
153 | */ |
||
154 | public function setReason($reason) |
||
160 | |||
161 | /** |
||
162 | * Get reason |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getReason() |
||
170 | |||
171 | /** |
||
172 | * Set title |
||
173 | * |
||
174 | * @param string $title |
||
175 | * @return Notification |
||
176 | */ |
||
177 | public function setTitle($title) |
||
183 | |||
184 | /** |
||
185 | * Get title |
||
186 | * |
||
187 | * @return string |
||
188 | */ |
||
189 | public function getTitle() |
||
193 | |||
194 | /** |
||
195 | * Set message |
||
196 | * |
||
197 | * @param string $message |
||
198 | * @return Notification |
||
199 | */ |
||
200 | public function setMessage($message) |
||
206 | |||
207 | /** |
||
208 | * Get message |
||
209 | * |
||
210 | * @return string |
||
211 | */ |
||
212 | public function getMessage() |
||
216 | |||
217 | /** |
||
218 | * Set resource |
||
219 | * |
||
220 | * @param string $resource |
||
221 | * @return Notification |
||
222 | */ |
||
223 | public function setResource($resource) |
||
229 | |||
230 | /** |
||
231 | * Get resource |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | public function getResource() |
||
239 | |||
240 | /** |
||
241 | * Set mode |
||
242 | * |
||
243 | * @param string $mode |
||
244 | * @return Notification |
||
245 | */ |
||
246 | public function setMode($mode) |
||
252 | |||
253 | /** |
||
254 | * Get mode |
||
255 | * |
||
256 | * @return string |
||
257 | */ |
||
258 | public function getMode() |
||
262 | |||
263 | /** |
||
264 | * Add recipient |
||
265 | * |
||
266 | * @param \KI\UserBundle\Entity\User $recipient |
||
267 | * @return Notification |
||
268 | */ |
||
269 | public function addRecipient(\KI\UserBundle\Entity\User $recipient) |
||
275 | |||
276 | /** |
||
277 | * Remove recipient |
||
278 | * |
||
279 | * @param \KI\UserBundle\Entity\User $recipient |
||
280 | */ |
||
281 | public function removeRecipient(\KI\UserBundle\Entity\User $recipient) |
||
285 | |||
286 | /** |
||
287 | * Get recipient |
||
288 | * |
||
289 | * @return \Doctrine\Common\Collections\Collection |
||
290 | */ |
||
291 | public function getRecipients() |
||
292 | { |
||
293 | return $this->recipients; |
||
294 | } |
||
295 | |||
296 | /** |
||
297 | * Add read |
||
298 | * |
||
299 | * @param \KI\UserBundle\Entity\User $read |
||
300 | * @return Notification |
||
301 | */ |
||
302 | public function addRead(\KI\UserBundle\Entity\User $read) |
||
308 | |||
309 | /** |
||
310 | * Remove read |
||
311 | * |
||
312 | * @param \KI\UserBundle\Entity\User $read |
||
313 | */ |
||
314 | public function removeRead(\KI\UserBundle\Entity\User $read) |
||
318 | |||
319 | /** |
||
320 | * Get read |
||
321 | * |
||
322 | * @return \Doctrine\Common\Collections\Collection |
||
323 | */ |
||
324 | public function getReads() |
||
328 | } |
||
329 |