|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use App\Model\LinksTrait; |
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
7
|
|
|
use Doctrine\Common\Collections\Collection; |
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
9
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
10
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
|
11
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
|
12
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
13
|
|
|
use App\Traits\TimestampableTrait; |
|
14
|
|
|
use App\Traits\DeletedByTrait; |
|
15
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
|
16
|
|
|
use JMS\Serializer\Annotation\Expose; |
|
17
|
|
|
use JMS\Serializer\Annotation\Type; |
|
18
|
|
|
use App\Validator\MinSizeSliderImage; |
|
19
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
|
20
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @ORM\Table(name="performances") |
|
24
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\PerformanceRepository") |
|
25
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
|
26
|
|
|
* @Gedmo\TranslationEntity(class="App\Entity\Translations\PerformanceTranslation") |
|
27
|
|
|
* @ExclusionPolicy("all") |
|
28
|
|
|
* @MinSizeSliderImage() |
|
29
|
|
|
*/ |
|
30
|
|
|
class Performance extends AbstractPersonalTranslatable implements TranslatableInterface |
|
31
|
|
|
{ |
|
32
|
|
|
use TimestampableTrait, LinksTrait, BlameableEntity, DeletedByTrait; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var integer |
|
36
|
|
|
* |
|
37
|
|
|
* @ORM\Column(name="id", type="integer") |
|
38
|
|
|
* @ORM\Id |
|
39
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
40
|
|
|
*/ |
|
41
|
|
|
private $id; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var string |
|
45
|
|
|
* @Gedmo\Translatable |
|
46
|
|
|
* @Assert\NotBlank() |
|
47
|
|
|
* @ORM\Column(type="string", length=255) |
|
48
|
|
|
* @Type("string") |
|
49
|
|
|
* @Expose |
|
50
|
|
|
*/ |
|
51
|
|
|
private $title; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var string |
|
55
|
|
|
* @Gedmo\Translatable |
|
56
|
|
|
* @ORM\Column(type="text", length=255, nullable=true) |
|
57
|
|
|
* @Type("string") |
|
58
|
|
|
* @Expose |
|
59
|
|
|
*/ |
|
60
|
|
|
private $type; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @var string |
|
64
|
|
|
* @Gedmo\Translatable |
|
65
|
|
|
* @Assert\NotBlank() |
|
66
|
|
|
* @ORM\Column(type="text", nullable=true) |
|
67
|
|
|
* @Type("string") |
|
68
|
|
|
* @Expose |
|
69
|
|
|
*/ |
|
70
|
|
|
private $description; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @var /Datetime |
|
74
|
|
|
* |
|
75
|
|
|
* @Assert\NotBlank() |
|
76
|
|
|
* @ORM\Column(type="datetime") |
|
77
|
|
|
* @Type("DateTime") |
|
78
|
|
|
* @Expose |
|
79
|
|
|
*/ |
|
80
|
|
|
private $premiere; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @var |
|
84
|
|
|
* |
|
85
|
|
|
* @ORM\OneToOne(targetEntity="App\Entity\Media", cascade={"persist"}) |
|
86
|
|
|
* @ORM\JoinColumn(name="mainPicture_id", referencedColumnName="id", nullable=true) |
|
87
|
|
|
*/ |
|
88
|
|
|
private $mainPicture; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @var |
|
92
|
|
|
* |
|
93
|
|
|
* @ORM\OneToOne(targetEntity="App\Entity\Media", cascade={"persist"}) |
|
94
|
|
|
* @ORM\JoinColumn(name="sliderImage_id", referencedColumnName="id", nullable=true) |
|
95
|
|
|
*/ |
|
96
|
|
|
private $sliderImage; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @var array |
|
100
|
|
|
* @Expose |
|
101
|
|
|
* @Type("array") |
|
102
|
|
|
* @SerializedName("mainPicture") |
|
103
|
|
|
*/ |
|
104
|
|
|
public $mainPictureThumbnails; |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @var array |
|
108
|
|
|
* @Expose |
|
109
|
|
|
* @Type("array") |
|
110
|
|
|
* @SerializedName("sliderImage") |
|
111
|
|
|
*/ |
|
112
|
|
|
public $sliderImageThumbnails; |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @var PerformanceEvent[] |
|
116
|
|
|
* |
|
117
|
|
|
* @ORM\OneToMany(targetEntity="App\Entity\PerformanceEvent", mappedBy="performance", cascade={"persist"}, orphanRemoval=true) |
|
118
|
|
|
*/ |
|
119
|
|
|
private $performanceEvents; |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @var Role[] |
|
123
|
|
|
* |
|
124
|
|
|
* @ORM\OneToMany(targetEntity="App\Entity\Role", mappedBy="performance", cascade={"persist", "remove"}, orphanRemoval=true) |
|
125
|
|
|
*/ |
|
126
|
|
|
private $roles; |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @var \App\Entity\GalleryHasMedia |
|
130
|
|
|
* |
|
131
|
|
|
* @ORM\ManyToMany(targetEntity="App\Entity\GalleryHasMedia", cascade={"persist"}, fetch="EAGER") |
|
132
|
|
|
* @ORM\JoinTable(name="performance_galleryHasMedia", |
|
133
|
|
|
* joinColumns={@ORM\JoinColumn(name="performance_id",referencedColumnName="id")}, |
|
134
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="galleryHasMedia_id",referencedColumnName="id")} |
|
135
|
|
|
* ) |
|
136
|
|
|
*/ |
|
137
|
|
|
private $galleryHasMedia; |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @var array |
|
141
|
|
|
* @Expose |
|
142
|
|
|
* @Type("array") |
|
143
|
|
|
* @SerializedName("gallery") |
|
144
|
|
|
*/ |
|
145
|
|
|
public $galleryHasMediaThumbnails; |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @Gedmo\Slug(fields={"title"}) |
|
149
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
|
150
|
|
|
* @Type("string") |
|
151
|
|
|
* @Expose |
|
152
|
|
|
*/ |
|
153
|
|
|
private $slug; |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @var ArrayCollection |
|
157
|
|
|
* |
|
158
|
|
|
* @ORM\OneToMany( |
|
159
|
|
|
* targetEntity="App\Entity\Translations\PerformanceTranslation", |
|
160
|
|
|
* mappedBy="object", |
|
161
|
|
|
* cascade={"persist", "remove"} |
|
162
|
|
|
* ) |
|
163
|
|
|
*/ |
|
164
|
|
|
protected $translations; |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @var \App\Entity\History |
|
168
|
|
|
* |
|
169
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\History", inversedBy="performances") |
|
170
|
|
|
*/ |
|
171
|
|
|
protected $festival; |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @ORM\ManyToMany(targetEntity="App\Entity\RepertoireSeason", inversedBy="performances") |
|
175
|
|
|
*/ |
|
176
|
|
|
private $seasons; |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Constructor |
|
180
|
|
|
*/ |
|
181
|
16 |
|
public function __construct() |
|
182
|
|
|
{ |
|
183
|
16 |
|
parent::__construct(); |
|
184
|
16 |
|
$this->performanceEvents = new ArrayCollection(); |
|
185
|
16 |
|
$this->roles = new ArrayCollection(); |
|
186
|
16 |
|
$this->galleryHasMedia = new ArrayCollection(); |
|
187
|
16 |
|
$this->seasons = new ArrayCollection(); |
|
188
|
16 |
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* Unset translations |
|
192
|
|
|
* |
|
193
|
|
|
* @return Performance |
|
194
|
|
|
*/ |
|
195
|
7 |
|
public function unsetTranslations() |
|
196
|
|
|
{ |
|
197
|
7 |
|
$this->translations = null; |
|
198
|
|
|
|
|
199
|
7 |
|
return $this; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Get id |
|
204
|
|
|
* |
|
205
|
|
|
* @return integer |
|
206
|
|
|
*/ |
|
207
|
3 |
|
public function getId() |
|
208
|
|
|
{ |
|
209
|
3 |
|
return $this->id; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* Get type |
|
214
|
|
|
* |
|
215
|
|
|
* @return string |
|
216
|
|
|
*/ |
|
217
|
3 |
|
public function getType() |
|
218
|
|
|
{ |
|
219
|
3 |
|
return $this->type; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* Set type |
|
224
|
|
|
* |
|
225
|
|
|
* @param string $type |
|
226
|
|
|
* @return Performance |
|
227
|
|
|
*/ |
|
228
|
|
|
public function setType($type) |
|
229
|
|
|
{ |
|
230
|
|
|
$this->type = $type; |
|
231
|
|
|
|
|
232
|
|
|
return $this; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
/** |
|
236
|
|
|
* Get description |
|
237
|
|
|
* |
|
238
|
|
|
* @return string |
|
239
|
|
|
*/ |
|
240
|
1 |
|
public function getDescription() |
|
241
|
|
|
{ |
|
242
|
1 |
|
return $this->description; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
/** |
|
246
|
|
|
* Set description |
|
247
|
|
|
* |
|
248
|
|
|
* @param string $description |
|
249
|
|
|
* @return Performance |
|
250
|
|
|
*/ |
|
251
|
|
|
public function setDescription($description) |
|
252
|
|
|
{ |
|
253
|
|
|
$this->description = $description; |
|
254
|
|
|
|
|
255
|
|
|
return $this; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* Get premiere |
|
260
|
|
|
* |
|
261
|
|
|
* @return \DateTime |
|
262
|
|
|
*/ |
|
263
|
3 |
|
public function getPremiere() |
|
264
|
|
|
{ |
|
265
|
3 |
|
return $this->premiere; |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* Set premiere |
|
270
|
|
|
* |
|
271
|
|
|
* @param \DateTime $premiere |
|
272
|
|
|
* @return Performance |
|
273
|
|
|
*/ |
|
274
|
|
|
public function setPremiere($premiere) |
|
275
|
|
|
{ |
|
276
|
|
|
$this->premiere = $premiere; |
|
277
|
|
|
|
|
278
|
|
|
return $this; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* Get mainPicture |
|
283
|
|
|
* |
|
284
|
|
|
* @return \App\Entity\Media |
|
285
|
|
|
*/ |
|
286
|
11 |
|
public function getMainPicture() |
|
287
|
|
|
{ |
|
288
|
11 |
|
return $this->mainPicture; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* Set mainPicture |
|
293
|
|
|
* |
|
294
|
|
|
* @param \App\Entity\Media $mainPicture |
|
295
|
|
|
* @return Performance |
|
296
|
|
|
*/ |
|
297
|
|
|
public function setMainPicture(\App\Entity\Media $mainPicture = null) |
|
298
|
|
|
{ |
|
299
|
|
|
$this->mainPicture = $mainPicture; |
|
300
|
|
|
|
|
301
|
|
|
return $this; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* Get sliderImage |
|
306
|
|
|
* |
|
307
|
|
|
* @return \App\Entity\Media |
|
308
|
|
|
*/ |
|
309
|
24 |
|
public function getSliderImage() |
|
310
|
|
|
{ |
|
311
|
24 |
|
return $this->sliderImage; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* Set sliderImage |
|
316
|
|
|
* |
|
317
|
|
|
* @param \App\Entity\Media $sliderImage |
|
318
|
|
|
* @return Performance |
|
319
|
|
|
*/ |
|
320
|
14 |
|
public function setSliderImage(\App\Entity\Media $sliderImage = null) |
|
321
|
|
|
{ |
|
322
|
14 |
|
$this->sliderImage = $sliderImage; |
|
323
|
|
|
|
|
324
|
14 |
|
return $this; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* Get slug |
|
329
|
|
|
* |
|
330
|
|
|
* @return string |
|
331
|
|
|
*/ |
|
332
|
5 |
|
public function getSlug() |
|
333
|
|
|
{ |
|
334
|
5 |
|
return $this->slug; |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* Set slug |
|
339
|
|
|
* |
|
340
|
|
|
* @param string $slug |
|
341
|
|
|
* @return Performance |
|
342
|
|
|
*/ |
|
343
|
|
|
public function setSlug($slug) |
|
344
|
|
|
{ |
|
345
|
|
|
$this->slug = $slug; |
|
346
|
|
|
|
|
347
|
|
|
return $this; |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
/** |
|
351
|
|
|
* Add performanceEvent |
|
352
|
|
|
* |
|
353
|
|
|
* @param \App\Entity\PerformanceEvent $performanceEvent |
|
354
|
|
|
* @return Performance |
|
355
|
|
|
*/ |
|
356
|
|
|
public function addPerformanceEvent(\App\Entity\PerformanceEvent $performanceEvent) |
|
357
|
|
|
{ |
|
358
|
|
|
$this->performanceEvents[] = $performanceEvent; |
|
359
|
|
|
|
|
360
|
|
|
return $this; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* Remove performanceEvent |
|
365
|
|
|
* |
|
366
|
|
|
* @param \App\Entity\PerformanceEvent $performanceEvent |
|
367
|
|
|
*/ |
|
368
|
|
|
public function removePerformanceEvent(\App\Entity\PerformanceEvent $performanceEvent) |
|
369
|
|
|
{ |
|
370
|
|
|
$this->performanceEvents->removeElement($performanceEvent); |
|
371
|
|
|
} |
|
372
|
|
|
|
|
373
|
|
|
/** |
|
374
|
|
|
* Get performanceEvents |
|
375
|
|
|
* |
|
376
|
|
|
* @return \Doctrine\Common\Collections\Collection |
|
377
|
|
|
*/ |
|
378
|
2 |
|
public function getPerformanceEvents() |
|
379
|
|
|
{ |
|
380
|
2 |
|
return $this->performanceEvents; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
/** |
|
384
|
|
|
* Add role |
|
385
|
|
|
* |
|
386
|
|
|
* @param \App\Entity\Role $role |
|
387
|
|
|
* @return Performance |
|
388
|
|
|
*/ |
|
389
|
|
|
public function addRole(\App\Entity\Role $role) |
|
390
|
|
|
{ |
|
391
|
|
|
$role->setPerformance($this); |
|
392
|
|
|
$this->roles[] = $role; |
|
393
|
|
|
|
|
394
|
|
|
return $this; |
|
395
|
|
|
} |
|
396
|
|
|
|
|
397
|
|
|
/** |
|
398
|
|
|
* Remove role |
|
399
|
|
|
* |
|
400
|
|
|
* @param \App\Entity\Role $role |
|
401
|
|
|
*/ |
|
402
|
|
|
public function removeRole(\App\Entity\Role $role) |
|
403
|
|
|
{ |
|
404
|
|
|
$this->roles->removeElement($role); |
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
|
|
/** |
|
408
|
|
|
* Get roles |
|
409
|
|
|
* |
|
410
|
|
|
* @return Role[]|\Doctrine\Common\Collections\Collection |
|
411
|
|
|
*/ |
|
412
|
4 |
|
public function getRoles() |
|
413
|
|
|
{ |
|
414
|
4 |
|
return $this->roles; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
6 |
|
public function __toString() |
|
418
|
|
|
{ |
|
419
|
6 |
|
return $this->getTitle(); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* Get title |
|
424
|
|
|
* |
|
425
|
|
|
* @return string |
|
426
|
|
|
*/ |
|
427
|
8 |
|
public function getTitle() |
|
428
|
|
|
{ |
|
429
|
8 |
|
return $this->title; |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
/** |
|
433
|
|
|
* Set title |
|
434
|
|
|
* |
|
435
|
|
|
* @param string $title |
|
436
|
|
|
* @return Performance |
|
437
|
|
|
*/ |
|
438
|
|
|
public function setTitle($title) |
|
439
|
|
|
{ |
|
440
|
|
|
$this->title = $title; |
|
441
|
|
|
|
|
442
|
|
|
return $this; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/** |
|
446
|
|
|
* Add galleryHasMedia |
|
447
|
|
|
* |
|
448
|
|
|
* @param \App\Entity\GalleryHasMedia $galleryHasMedia |
|
449
|
|
|
* @return Performance |
|
450
|
|
|
*/ |
|
451
|
|
|
public function addGalleryHasMedia(\App\Entity\GalleryHasMedia $galleryHasMedia) |
|
452
|
|
|
{ |
|
453
|
|
|
$this->galleryHasMedia[] = $galleryHasMedia; |
|
454
|
|
|
|
|
455
|
|
|
return $this; |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
/** |
|
459
|
|
|
* Remove galleryHasMedia |
|
460
|
|
|
* |
|
461
|
|
|
* @param \App\Entity\GalleryHasMedia $galleryHasMedia |
|
462
|
|
|
*/ |
|
463
|
|
|
public function removeGalleryHasMedia(\App\Entity\GalleryHasMedia $galleryHasMedia) |
|
464
|
|
|
{ |
|
465
|
|
|
$this->galleryHasMedia->removeElement($galleryHasMedia); |
|
|
|
|
|
|
466
|
|
|
} |
|
467
|
|
|
|
|
468
|
|
|
/** |
|
469
|
|
|
* Get galleryHasMedia |
|
470
|
|
|
* |
|
471
|
|
|
* @return \Doctrine\Common\Collections\Collection |
|
472
|
|
|
*/ |
|
473
|
9 |
|
public function getGalleryHasMedia() |
|
474
|
|
|
{ |
|
475
|
9 |
|
return $this->galleryHasMedia; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
/** |
|
479
|
|
|
* @return Festival |
|
480
|
|
|
*/ |
|
481
|
3 |
|
public function getFestival() |
|
482
|
|
|
{ |
|
483
|
3 |
|
return $this->festival; |
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
|
/** |
|
487
|
|
|
* @param Festival $festival |
|
488
|
|
|
* @return $this |
|
489
|
|
|
*/ |
|
490
|
|
|
public function setFestival($festival) |
|
491
|
|
|
{ |
|
492
|
|
|
$this->festival = $festival; |
|
493
|
|
|
|
|
494
|
|
|
return $this; |
|
495
|
|
|
} |
|
496
|
|
|
|
|
497
|
|
|
/** |
|
498
|
|
|
* @return Collection|RepertoireSeason[] |
|
499
|
|
|
*/ |
|
500
|
5 |
|
public function getSeasons(): Collection |
|
501
|
|
|
{ |
|
502
|
5 |
|
return $this->seasons; |
|
503
|
|
|
} |
|
504
|
|
|
|
|
505
|
1 |
|
public function addSeason(RepertoireSeason $season): self |
|
506
|
|
|
{ |
|
507
|
1 |
|
if (!$this->seasons->contains($season)) { |
|
508
|
1 |
|
$this->seasons[] = $season; |
|
509
|
|
|
} |
|
510
|
|
|
|
|
511
|
1 |
|
return $this; |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
public function removeSeason(RepertoireSeason $season): self |
|
515
|
|
|
{ |
|
516
|
|
|
if ($this->seasons->contains($season)) { |
|
517
|
|
|
$this->seasons->removeElement($season); |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
return $this; |
|
521
|
|
|
} |
|
522
|
|
|
} |
|
523
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.