|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Stringable; |
|
6
|
|
|
use App\Validator\CollectionNotEmpty; |
|
7
|
|
|
use App\Validator\SubsetOf; |
|
8
|
|
|
use DateTime; |
|
9
|
|
|
use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable; |
|
10
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
11
|
|
|
use Doctrine\Common\Collections\Collection; |
|
12
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
13
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
14
|
|
|
use Ramsey\Uuid\Uuid; |
|
15
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
16
|
|
|
|
|
17
|
|
|
#[Auditable] |
|
18
|
|
|
#[ORM\Entity] |
|
19
|
|
|
#[ORM\Index(columns: ['title'], flags: ['fulltext'])] |
|
20
|
|
|
#[ORM\Index(columns: ['content'], flags: ['fulltext'])] |
|
21
|
|
|
class Message implements Stringable { |
|
22
|
|
|
|
|
23
|
|
|
use IdTrait; |
|
24
|
|
|
use UuidTrait; |
|
25
|
|
|
|
|
26
|
|
|
#[Assert\NotBlank] |
|
27
|
|
|
#[ORM\Column(type: 'string')] |
|
28
|
|
|
private ?string $title = null; |
|
29
|
|
|
|
|
30
|
|
|
#[Assert\NotBlank] |
|
31
|
|
|
#[ORM\Column(type: 'text')] |
|
32
|
|
|
private ?string $content = null; |
|
33
|
|
|
|
|
34
|
|
|
#[Assert\NotNull] |
|
35
|
|
|
#[ORM\Column(type: 'datetime')] |
|
36
|
|
|
private ?DateTime $startDate = null; |
|
37
|
|
|
|
|
38
|
|
|
#[Assert\GreaterThan(propertyPath: 'startDate')] |
|
39
|
|
|
#[Assert\NotNull] |
|
40
|
|
|
#[ORM\Column(type: 'datetime')] |
|
41
|
|
|
private ?DateTime $expireDate = null; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var Collection<StudyGroup> |
|
45
|
|
|
*/ |
|
46
|
|
|
#[ORM\JoinTable(name: 'message_studygroups')] |
|
47
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
48
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
49
|
|
|
#[ORM\ManyToMany(targetEntity: StudyGroup::class)] |
|
50
|
|
|
#[ORM\OrderBy(['name' => 'ASC'])] |
|
51
|
|
|
#[CollectionNotEmpty(propertyPath: 'visibilities')] |
|
52
|
|
|
private $studyGroups; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var ArrayCollection<MessageAttachment> |
|
56
|
|
|
*/ |
|
57
|
|
|
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessageAttachment::class, cascade: ['persist'])] |
|
58
|
|
|
#[ORM\OrderBy(['filename' => 'asc'])] |
|
59
|
|
|
private $attachments; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var Collection<UserTypeEntity> |
|
63
|
|
|
*/ |
|
64
|
|
|
#[ORM\JoinTable(name: 'message_visibilities')] |
|
65
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
66
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
67
|
|
|
#[ORM\ManyToMany(targetEntity: UserTypeEntity::class)] |
|
68
|
|
|
private $visibilities; |
|
69
|
|
|
|
|
70
|
|
|
#[ORM\Column(type: 'string', enumType: MessageScope::class)] |
|
71
|
|
|
private MessageScope $scope; |
|
72
|
|
|
|
|
73
|
|
|
#[Gedmo\Blameable(on: 'create')] |
|
74
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
|
75
|
|
|
#[ORM\JoinColumn(onDelete: 'SET NULL')] |
|
76
|
|
|
private ?User $createdBy = null; |
|
77
|
|
|
|
|
78
|
|
|
#[Gedmo\Timestampable(on: 'create')] |
|
79
|
|
|
#[ORM\Column(type: 'datetime')] |
|
80
|
|
|
private DateTime $createdAt; |
|
81
|
|
|
|
|
82
|
|
|
#[Gedmo\Timestampable(on: 'update')] |
|
83
|
|
|
#[ORM\Column(type: 'datetime', nullable: true)] |
|
84
|
|
|
private ?DateTime $updatedAt; |
|
85
|
|
|
|
|
86
|
|
|
#[Gedmo\Blameable(on: 'update')] |
|
87
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
|
88
|
|
|
#[ORM\JoinColumn(onDelete: 'SET NULL')] |
|
89
|
|
|
private ?User $updatedBy = null; |
|
90
|
|
|
|
|
91
|
|
|
#[ORM\Column(type: 'boolean')] |
|
92
|
|
|
private bool $isDownloadsEnabled = false; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @var Collection<UserTypeEntity> |
|
96
|
|
|
*/ |
|
97
|
|
|
#[ORM\JoinTable(name: 'message_download_usertypes')] |
|
98
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
99
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
100
|
|
|
#[ORM\ManyToMany(targetEntity: UserTypeEntity::class)] |
|
101
|
|
|
#[SubsetOf(propertyPath: 'visibilities')] |
|
102
|
|
|
private $downloadEnabledUserTypes; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @var Collection<StudyGroup> |
|
106
|
|
|
*/ |
|
107
|
|
|
#[ORM\JoinTable(name: 'message_download_studygroups')] |
|
108
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
109
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
110
|
|
|
#[ORM\ManyToMany(targetEntity: StudyGroup::class)] |
|
111
|
|
|
#[ORM\OrderBy(['name' => 'ASC'])] |
|
112
|
|
|
#[SubsetOf(propertyPath: 'studyGroups')] |
|
113
|
|
|
private $downloadEnabledStudyGroups; |
|
114
|
|
|
|
|
115
|
|
|
#[ORM\Column(type: 'boolean')] |
|
116
|
|
|
private bool $isUploadsEnabled = false; |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @var Collection<UserTypeEntity> |
|
120
|
|
|
*/ |
|
121
|
|
|
#[ORM\JoinTable(name: 'message_upload_usertypes')] |
|
122
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
123
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
124
|
|
|
#[ORM\ManyToMany(targetEntity: UserTypeEntity::class)] |
|
125
|
|
|
#[SubsetOf(propertyPath: 'visibilities')] |
|
126
|
|
|
private $uploadEnabledUserTypes; |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @var Collection<StudyGroup> |
|
130
|
|
|
*/ |
|
131
|
|
|
#[ORM\JoinTable(name: 'message_upload_studygroups')] |
|
132
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
133
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
134
|
|
|
#[ORM\ManyToMany(targetEntity: StudyGroup::class)] |
|
135
|
|
|
#[ORM\OrderBy(['name' => 'ASC'])] |
|
136
|
|
|
#[SubsetOf(propertyPath: 'studyGroups')] |
|
137
|
|
|
private $uploadEnabledStudyGroups; |
|
138
|
|
|
|
|
139
|
|
|
#[ORM\Column(type: 'text', nullable: true)] |
|
140
|
|
|
private ?string $uploadDescription = null; |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @var Collection<MessageFile> |
|
144
|
|
|
*/ |
|
145
|
|
|
#[Assert\Valid] |
|
146
|
|
|
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessageFile::class, cascade: ['persist'])] |
|
147
|
|
|
private $files; |
|
148
|
|
|
|
|
149
|
|
|
#[ORM\Column(type: 'boolean')] |
|
150
|
|
|
private bool $isEmailNotificationSent = false; |
|
151
|
|
|
|
|
152
|
|
|
#[ORM\Column(type: 'boolean')] |
|
153
|
|
|
private bool $isPushNotificationSent = false; |
|
154
|
|
|
|
|
155
|
|
|
#[ORM\Column(type: 'boolean')] |
|
156
|
|
|
private bool $mustConfirm = false; |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @var Collection<UserTypeEntity> |
|
160
|
|
|
*/ |
|
161
|
|
|
#[ORM\JoinTable(name: 'message_confirmation_usertypes')] |
|
162
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
163
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
164
|
|
|
#[ORM\ManyToMany(targetEntity: UserTypeEntity::class)] |
|
165
|
|
|
#[SubsetOf(propertyPath: 'visibilities')] |
|
166
|
|
|
private $confirmationRequiredUserTypes; |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @var Collection<StudyGroup> |
|
170
|
|
|
*/ |
|
171
|
|
|
#[ORM\JoinTable(name: 'message_confirmation_studygroups')] |
|
172
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
173
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
174
|
|
|
#[ORM\ManyToMany(targetEntity: StudyGroup::class)] |
|
175
|
|
|
#[ORM\OrderBy(['name' => 'ASC'])] |
|
176
|
|
|
#[SubsetOf(propertyPath: 'studyGroups')] |
|
177
|
|
|
private $confirmationRequiredStudyGroups; |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @var Collection<MessageConfirmation> |
|
181
|
|
|
*/ |
|
182
|
|
|
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessageConfirmation::class)] |
|
183
|
|
|
private $confirmations; |
|
184
|
|
|
|
|
185
|
|
|
#[ORM\Column(type: 'string', enumType: MessagePriority::class)] |
|
186
|
|
|
private MessagePriority $priority; |
|
187
|
|
|
|
|
188
|
|
|
#[ORM\Column(type: 'boolean')] |
|
189
|
|
|
private bool $isPollEnabled = false; |
|
190
|
|
|
|
|
191
|
|
|
#[ORM\Column(type: 'boolean')] |
|
192
|
|
|
private bool $allowPollRevote = true; |
|
193
|
|
|
|
|
194
|
|
|
#[Assert\GreaterThanOrEqual(1)] |
|
195
|
|
|
#[ORM\Column(type: 'integer')] |
|
196
|
|
|
private int $pollNumChoices = 1; |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @var Collection<UserTypeEntity> |
|
200
|
|
|
*/ |
|
201
|
|
|
#[ORM\JoinTable(name: 'message_poll_usertypes')] |
|
202
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
203
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
204
|
|
|
#[ORM\ManyToMany(targetEntity: UserTypeEntity::class)] |
|
205
|
|
|
#[SubsetOf(propertyPath: 'visibilities')] |
|
206
|
|
|
private $pollUserTypes; |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* @var Collection<StudyGroup> |
|
210
|
|
|
*/ |
|
211
|
|
|
#[ORM\JoinTable(name: 'message_poll_studygroups')] |
|
212
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE')] |
|
213
|
|
|
#[ORM\InverseJoinColumn(onDelete: 'CASCADE')] |
|
214
|
|
|
#[ORM\ManyToMany(targetEntity: StudyGroup::class)] |
|
215
|
|
|
#[ORM\OrderBy(['name' => 'ASC'])] |
|
216
|
|
|
#[SubsetOf(propertyPath: 'studyGroups')] |
|
217
|
|
|
private $pollStudyGroups; |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* @var Collection<MessagePollChoice> |
|
221
|
|
|
*/ |
|
222
|
|
|
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessagePollChoice::class, cascade: ['persist'], orphanRemoval: true)] |
|
223
|
|
|
private $pollChoices; |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* @var Collection<MessagePollVote> |
|
227
|
|
|
*/ |
|
228
|
|
|
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessagePollVote::class)] |
|
229
|
|
|
private $pollVotes; |
|
230
|
|
|
|
|
231
|
|
|
public function __construct() { |
|
232
|
|
|
$this->uuid = Uuid::uuid4(); |
|
233
|
|
|
|
|
234
|
|
|
$this->studyGroups = new ArrayCollection(); |
|
235
|
|
|
$this->attachments = new ArrayCollection(); |
|
236
|
|
|
$this->files = new ArrayCollection(); |
|
237
|
|
|
$this->visibilities = new ArrayCollection(); |
|
238
|
|
|
$this->confirmations = new ArrayCollection(); |
|
239
|
|
|
$this->confirmationRequiredStudyGroups = new ArrayCollection(); |
|
240
|
|
|
$this->confirmationRequiredUserTypes = new ArrayCollection(); |
|
241
|
|
|
$this->uploadEnabledStudyGroups = new ArrayCollection(); |
|
242
|
|
|
$this->uploadEnabledUserTypes = new ArrayCollection(); |
|
243
|
|
|
$this->downloadEnabledStudyGroups = new ArrayCollection(); |
|
244
|
|
|
$this->downloadEnabledUserTypes = new ArrayCollection(); |
|
245
|
10 |
|
$this->pollStudyGroups = new ArrayCollection(); |
|
246
|
10 |
|
$this->pollUserTypes = new ArrayCollection(); |
|
247
|
|
|
$this->pollChoices = new ArrayCollection(); |
|
248
|
10 |
|
$this->pollVotes = new ArrayCollection(); |
|
249
|
10 |
|
|
|
250
|
10 |
|
$this->scope = MessageScope::Messages; |
|
251
|
10 |
|
$this->priority = MessagePriority::Normal; |
|
252
|
10 |
|
} |
|
253
|
10 |
|
|
|
254
|
10 |
|
/** |
|
255
|
10 |
|
* @return string |
|
256
|
10 |
|
*/ |
|
257
|
10 |
|
public function getTitle(): ?string { |
|
258
|
10 |
|
return $this->title; |
|
259
|
|
|
} |
|
260
|
10 |
|
|
|
261
|
10 |
|
/** |
|
262
|
10 |
|
* @param string $title |
|
263
|
|
|
*/ |
|
264
|
|
|
public function setTitle(?string $title): Message { |
|
265
|
|
|
$this->title = $title; |
|
266
|
|
|
return $this; |
|
267
|
2 |
|
} |
|
268
|
2 |
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* @return string |
|
271
|
|
|
*/ |
|
272
|
|
|
public function getContent(): ?string { |
|
273
|
|
|
return $this->content; |
|
274
|
|
|
} |
|
275
|
2 |
|
|
|
276
|
2 |
|
/** |
|
277
|
2 |
|
* @param string $content |
|
278
|
|
|
*/ |
|
279
|
|
|
public function setContent(?string $content): Message { |
|
280
|
|
|
$this->content = $content; |
|
281
|
|
|
return $this; |
|
282
|
|
|
} |
|
283
|
1 |
|
|
|
284
|
1 |
|
/** |
|
285
|
|
|
* @return DateTime |
|
286
|
|
|
*/ |
|
287
|
|
|
public function getStartDate(): ?DateTime { |
|
288
|
|
|
return $this->startDate; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
2 |
|
public function setStartDate(DateTime $startDate): Message { |
|
292
|
2 |
|
$this->startDate = $startDate; |
|
293
|
2 |
|
return $this; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
/** |
|
297
|
|
|
* @return DateTime |
|
298
|
|
|
*/ |
|
299
|
2 |
|
public function getExpireDate(): ?DateTime { |
|
300
|
2 |
|
return $this->expireDate; |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
public function setExpireDate(DateTime $expireDate): Message { |
|
304
|
|
|
$this->expireDate = $expireDate; |
|
305
|
|
|
return $this; |
|
306
|
|
|
} |
|
307
|
2 |
|
|
|
308
|
2 |
|
public function addStudyGroup(StudyGroup $studyGroup) { |
|
309
|
2 |
|
$this->studyGroups->add($studyGroup); |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
public function removeStudyGroups(StudyGroup $studyGroup) { |
|
313
|
|
|
$this->studyGroups->removeElement($studyGroup); |
|
314
|
|
|
} |
|
315
|
1 |
|
|
|
316
|
1 |
|
/** |
|
317
|
|
|
* @return Collection<StudyGroup> |
|
318
|
|
|
*/ |
|
319
|
|
|
public function getStudyGroups(): Collection { |
|
320
|
|
|
return $this->studyGroups; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
2 |
|
public function addAttachment(MessageAttachment $attachment) { |
|
324
|
2 |
|
if($attachment->getMessage() === $this) { |
|
325
|
2 |
|
// Do not readd already existing attachments (seems to fix a bug with VichUploaderBundle https://github.com/dustin10/VichUploaderBundle/issues/842) |
|
326
|
|
|
return; |
|
327
|
|
|
} |
|
328
|
2 |
|
|
|
329
|
2 |
|
$attachment->setMessage($this); // important as MessageFilesystem needs $attachment->getMessage() |
|
330
|
2 |
|
$this->attachments->add($attachment); |
|
331
|
|
|
} |
|
332
|
1 |
|
|
|
333
|
1 |
|
public function removeAttachment(MessageAttachment $attachment) { |
|
334
|
1 |
|
$this->attachments->removeElement($attachment); |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* @return Collection<MessageAttachment> |
|
339
|
5 |
|
*/ |
|
340
|
5 |
|
public function getAttachments(): Collection { |
|
341
|
|
|
return $this->attachments; |
|
342
|
|
|
} |
|
343
|
1 |
|
|
|
344
|
1 |
|
public function addVisibility(UserTypeEntity $visibility) { |
|
345
|
|
|
$this->visibilities->add($visibility); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
public function removeVisibility(UserTypeEntity $visibility) { |
|
349
|
1 |
|
$this->visibilities->removeElement($visibility); |
|
350
|
1 |
|
} |
|
351
|
1 |
|
|
|
352
|
|
|
/** |
|
353
|
1 |
|
* @return Collection<UserTypeEntity> |
|
354
|
1 |
|
*/ |
|
355
|
1 |
|
public function getVisibilities(): Collection { |
|
356
|
|
|
return $this->visibilities; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
public function getScope(): MessageScope { |
|
360
|
2 |
|
return $this->scope; |
|
361
|
2 |
|
} |
|
362
|
|
|
|
|
363
|
|
|
public function setScope(MessageScope $scope): Message { |
|
364
|
4 |
|
$this->scope = $scope; |
|
365
|
4 |
|
return $this; |
|
366
|
4 |
|
} |
|
367
|
|
|
|
|
368
|
1 |
|
public function getCreatedBy(): ?User { |
|
369
|
1 |
|
return $this->createdBy; |
|
370
|
1 |
|
} |
|
371
|
|
|
|
|
372
|
|
|
public function setCreatedBy(User $createdBy): Message { |
|
373
|
|
|
$this->createdBy = $createdBy; |
|
374
|
|
|
return $this; |
|
375
|
5 |
|
} |
|
376
|
5 |
|
|
|
377
|
|
|
public function isDownloadsEnabled(): bool { |
|
378
|
|
|
return $this->isDownloadsEnabled; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
public function setIsDownloadsEnabled(bool $isDownloadsEnabled): Message { |
|
382
|
1 |
|
$this->isDownloadsEnabled = $isDownloadsEnabled; |
|
383
|
1 |
|
return $this; |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
public function isUploadsEnabled(): bool { |
|
387
|
|
|
return $this->isUploadsEnabled; |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
2 |
|
public function setIsUploadsEnabled(bool $isUploadsEnabled): Message { |
|
391
|
2 |
|
$this->isUploadsEnabled = $isUploadsEnabled; |
|
392
|
2 |
|
return $this; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
public function getUploadDescription(): ?string { |
|
396
|
|
|
return $this->uploadDescription; |
|
397
|
|
|
} |
|
398
|
1 |
|
|
|
399
|
1 |
|
public function setUploadDescription(?string $uploadDescription): Message { |
|
400
|
|
|
$this->uploadDescription = $uploadDescription; |
|
401
|
|
|
return $this; |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
public function addFile(MessageFile $file) { |
|
405
|
|
|
$file->setMessage($this); |
|
406
|
1 |
|
$this->files->add($file); |
|
407
|
1 |
|
} |
|
408
|
1 |
|
|
|
409
|
|
|
public function removeFile(MessageFile $file) { |
|
410
|
|
|
$this->files->removeElement($file); |
|
411
|
|
|
} |
|
412
|
|
|
|
|
413
|
|
|
/** |
|
414
|
1 |
|
* @return Collection<MessageFile> |
|
415
|
1 |
|
*/ |
|
416
|
|
|
public function getFiles(): Collection { |
|
417
|
|
|
return $this->files; |
|
418
|
|
|
} |
|
419
|
|
|
|
|
420
|
|
|
public function isEmailNotificationSent(): bool { |
|
421
|
|
|
return $this->isEmailNotificationSent; |
|
422
|
1 |
|
} |
|
423
|
1 |
|
|
|
424
|
1 |
|
public function setIsEmailNotificationSent(bool $isEmailNotificationSent): Message { |
|
425
|
|
|
$this->isEmailNotificationSent = $isEmailNotificationSent; |
|
426
|
|
|
return $this; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
public function isPushNotificationSent(): bool { |
|
430
|
1 |
|
return $this->isPushNotificationSent; |
|
431
|
1 |
|
} |
|
432
|
|
|
|
|
433
|
|
|
public function setIsPushNotificationSent(bool $isPushNotificationSent): Message { |
|
434
|
|
|
$this->isPushNotificationSent = $isPushNotificationSent; |
|
435
|
|
|
return $this; |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
1 |
|
public function mustConfirm(): bool { |
|
439
|
1 |
|
return $this->mustConfirm; |
|
440
|
1 |
|
} |
|
441
|
|
|
|
|
442
|
|
|
public function setMustConfirm(bool $mustConfirm): Message { |
|
443
|
|
|
$this->mustConfirm = $mustConfirm; |
|
444
|
|
|
return $this; |
|
445
|
|
|
} |
|
446
|
1 |
|
|
|
447
|
1 |
|
/** |
|
448
|
|
|
* @return Collection<MessageConfirmation> |
|
449
|
|
|
*/ |
|
450
|
|
|
public function getConfirmations(): Collection { |
|
451
|
|
|
return $this->confirmations; |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
1 |
|
public function getUploadEnabledUserTypes(): Collection { |
|
455
|
1 |
|
return $this->uploadEnabledUserTypes; |
|
456
|
1 |
|
} |
|
457
|
|
|
|
|
458
|
|
|
public function getDownloadEnabledUserTypes(): Collection { |
|
459
|
1 |
|
return $this->downloadEnabledUserTypes; |
|
460
|
1 |
|
} |
|
461
|
1 |
|
|
|
462
|
1 |
|
public function getDownloadEnabledStudyGroups(): Collection { |
|
463
|
|
|
return $this->downloadEnabledStudyGroups; |
|
464
|
1 |
|
} |
|
465
|
1 |
|
|
|
466
|
1 |
|
public function getUploadEnabledStudyGroups(): Collection { |
|
467
|
|
|
return $this->uploadEnabledStudyGroups; |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
public function getConfirmationRequiredUserTypes(): Collection { |
|
471
|
1 |
|
return $this->confirmationRequiredUserTypes; |
|
472
|
1 |
|
} |
|
473
|
|
|
|
|
474
|
|
|
public function getConfirmationRequiredStudyGroups(): Collection { |
|
475
|
|
|
return $this->confirmationRequiredStudyGroups; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
2 |
|
public function getPriority(): MessagePriority { |
|
479
|
2 |
|
return $this->priority; |
|
480
|
|
|
} |
|
481
|
|
|
|
|
482
|
|
|
public function setPriority(MessagePriority $priority): Message { |
|
483
|
|
|
$this->priority = $priority; |
|
484
|
|
|
return $this; |
|
485
|
|
|
} |
|
486
|
2 |
|
|
|
487
|
2 |
|
public function isPollEnabled(): bool { |
|
488
|
2 |
|
return $this->isPollEnabled; |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
|
|
public function setIsPollEnabled(bool $isPollEnabled): Message { |
|
492
|
|
|
$this->isPollEnabled = $isPollEnabled; |
|
493
|
|
|
return $this; |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
public function isAllowPollRevote(): bool { |
|
497
|
|
|
return $this->allowPollRevote; |
|
498
|
|
|
} |
|
499
|
|
|
|
|
500
|
|
|
public function setAllowPollRevote(bool $allowPollRevote): Message { |
|
501
|
|
|
$this->allowPollRevote = $allowPollRevote; |
|
502
|
|
|
return $this; |
|
503
|
|
|
} |
|
504
|
|
|
|
|
505
|
|
|
public function getPollNumChoices(): int { |
|
506
|
|
|
return $this->pollNumChoices; |
|
507
|
|
|
} |
|
508
|
|
|
|
|
509
|
|
|
public function setPollNumChoices(int $pollNumChoices): Message { |
|
510
|
1 |
|
$this->pollNumChoices = $pollNumChoices; |
|
511
|
1 |
|
return $this; |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
public function getPollUserTypes(): Collection { |
|
515
|
|
|
return $this->pollUserTypes; |
|
516
|
|
|
} |
|
517
|
|
|
|
|
518
|
1 |
|
public function getPollStudyGroups(): Collection { |
|
519
|
1 |
|
return $this->pollStudyGroups; |
|
520
|
1 |
|
} |
|
521
|
|
|
|
|
522
|
|
|
public function getPollChoices(): Collection { |
|
523
|
|
|
return $this->pollChoices; |
|
524
|
|
|
} |
|
525
|
|
|
|
|
526
|
1 |
|
public function addPollChoice(MessagePollChoice $choice): void { |
|
527
|
1 |
|
$choice->setMessage($this); |
|
528
|
|
|
$this->pollChoices->add($choice); |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
public function removePollChoice(MessagePollChoice $choice): void { |
|
532
|
|
|
$this->pollChoices->removeElement($choice); |
|
533
|
|
|
} |
|
534
|
|
|
|
|
535
|
|
|
public function addPollVote(MessagePollVote $vote): void { |
|
536
|
|
|
$this->pollVotes->add($vote); |
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
|
|
public function getPollVotes(): Collection { |
|
540
|
|
|
return $this->pollVotes; |
|
541
|
|
|
} |
|
542
|
|
|
|
|
543
|
|
|
public function getCreatedAt(): DateTime { |
|
544
|
|
|
return $this->createdAt; |
|
545
|
|
|
} |
|
546
|
|
|
|
|
547
|
|
|
public function getUpdatedAt(): DateTime { |
|
548
|
|
|
if($this->updatedAt === null) { |
|
549
|
|
|
return $this->getCreatedAt(); |
|
550
|
|
|
} |
|
551
|
|
|
|
|
552
|
|
|
return $this->updatedAt; |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
public function getUpdatedBy(): ?User { |
|
556
|
|
|
if($this->updatedBy === null) { |
|
557
|
|
|
return $this->getCreatedBy(); |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
return $this->updatedBy; |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
public function __toString(): string { |
|
564
|
|
|
return (string) $this->getTitle(); |
|
565
|
|
|
} |
|
566
|
|
|
} |