1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use AppBundle\Model\LinksTrait; |
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
9
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
10
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
11
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
12
|
|
|
use AppBundle\Traits\TimestampableTrait; |
13
|
|
|
use AppBundle\Traits\DeletedByTrait; |
14
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
15
|
|
|
use JMS\Serializer\Annotation\Expose; |
16
|
|
|
use JMS\Serializer\Annotation\Type; |
17
|
|
|
use AppBundle\Validator\MinSizeSliderImage; |
18
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
19
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @ORM\Table(name="performances") |
23
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\PerformanceRepository") |
24
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
25
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\PerformanceTranslation") |
26
|
|
|
* @ExclusionPolicy("all") |
27
|
|
|
* @MinSizeSliderImage() |
28
|
|
|
* @SuppressWarnings(PHPMD.TooManyFields) |
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="Application\Sonata\MediaBundle\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="Application\Sonata\MediaBundle\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 ArrayCollection|PerformanceEvent[] |
116
|
|
|
* |
117
|
|
|
* @ORM\OneToMany( |
118
|
|
|
* targetEntity="AppBundle\Entity\PerformanceEvent", |
119
|
|
|
* mappedBy="performance", |
120
|
|
|
* cascade={"persist"}, |
121
|
|
|
* orphanRemoval=true |
122
|
|
|
* ) |
123
|
|
|
*/ |
124
|
|
|
private $performanceEvents; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var ArrayCollection|Role[] |
128
|
|
|
* |
129
|
|
|
* @ORM\OneToMany( |
130
|
|
|
* targetEntity="AppBundle\Entity\Role", |
131
|
|
|
* mappedBy="performance", |
132
|
|
|
* cascade={"persist", "remove"}, |
133
|
|
|
* orphanRemoval=true |
134
|
|
|
* ) |
135
|
|
|
*/ |
136
|
|
|
private $roles; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var ArrayCollection|GalleryHasMedia[] |
140
|
|
|
* |
141
|
|
|
* @ORM\ManyToMany(targetEntity="Application\Sonata\MediaBundle\Entity\GalleryHasMedia", cascade={"persist"}) |
142
|
|
|
* @ORM\JoinTable(name="performance_galleryHasMedia", |
143
|
|
|
* joinColumns={@ORM\JoinColumn(name="performance_id",referencedColumnName="id")}, |
144
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="galleryHasMedia_id",referencedColumnName="id")} |
145
|
|
|
* ) |
146
|
|
|
*/ |
147
|
|
|
private $galleryHasMedia; |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @var array |
151
|
|
|
* @Expose |
152
|
|
|
* @Type("array") |
153
|
|
|
* @SerializedName("gallery") |
154
|
|
|
*/ |
155
|
|
|
public $galleryHasMediaThumbnails; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @Gedmo\Slug(fields={"title"}) |
159
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
160
|
|
|
* @Type("string") |
161
|
|
|
* @Expose |
162
|
|
|
*/ |
163
|
|
|
private $slug; |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @var ArrayCollection|Translation[] |
167
|
|
|
* |
168
|
|
|
* @ORM\OneToMany( |
169
|
|
|
* targetEntity="AppBundle\Entity\Translations\PerformanceTranslation", |
170
|
|
|
* mappedBy="object", |
171
|
|
|
* cascade={"persist", "remove"} |
172
|
|
|
* ) |
173
|
|
|
*/ |
174
|
|
|
protected $translations; |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @var \AppBundle\Entity\History |
178
|
|
|
* |
179
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\History", inversedBy="performances") |
180
|
|
|
*/ |
181
|
|
|
protected $festival; |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Constructor |
185
|
|
|
*/ |
186
|
|
|
public function __construct() |
187
|
|
|
{ |
188
|
|
|
parent::__construct(); |
189
|
|
|
$this->performanceEvents = new \Doctrine\Common\Collections\ArrayCollection(); |
190
|
|
|
$this->roles = new \Doctrine\Common\Collections\ArrayCollection(); |
191
|
|
|
$this->galleryHasMedia = new \Doctrine\Common\Collections\ArrayCollection(); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Unset translations |
196
|
|
|
* |
197
|
|
|
* @return Performance |
198
|
|
|
*/ |
199
|
8 |
|
public function unsetTranslations() |
200
|
|
|
{ |
201
|
8 |
|
$this->translations = null; |
202
|
|
|
|
203
|
8 |
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Get id |
208
|
|
|
* |
209
|
|
|
* @return integer |
210
|
|
|
*/ |
211
|
1 |
|
public function getId() |
212
|
|
|
{ |
213
|
1 |
|
return $this->id; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Get type |
218
|
|
|
* |
219
|
|
|
* @return string |
220
|
|
|
*/ |
221
|
|
|
public function getType() |
222
|
|
|
{ |
223
|
|
|
return $this->type; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Set type |
228
|
|
|
* |
229
|
|
|
* @param string $type |
230
|
|
|
* @return Performance |
231
|
|
|
*/ |
232
|
|
|
public function setType($type) |
233
|
|
|
{ |
234
|
|
|
$this->type = $type; |
235
|
|
|
|
236
|
|
|
return $this; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* Get description |
241
|
|
|
* |
242
|
|
|
* @return string |
243
|
|
|
*/ |
244
|
|
|
public function getDescription() |
245
|
|
|
{ |
246
|
|
|
return $this->description; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* Set description |
251
|
|
|
* |
252
|
|
|
* @param string $description |
253
|
|
|
* @return Performance |
254
|
|
|
*/ |
255
|
|
|
public function setDescription($description) |
256
|
|
|
{ |
257
|
|
|
$this->description = $description; |
258
|
|
|
|
259
|
|
|
return $this; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Get premiere |
264
|
|
|
* |
265
|
|
|
* @return \DateTime |
266
|
|
|
*/ |
267
|
|
|
public function getPremiere() |
268
|
|
|
{ |
269
|
|
|
return $this->premiere; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Set premiere |
274
|
|
|
* |
275
|
|
|
* @param \DateTime $premiere |
276
|
|
|
* @return Performance |
277
|
|
|
*/ |
278
|
|
|
public function setPremiere($premiere) |
279
|
|
|
{ |
280
|
|
|
$this->premiere = $premiere; |
281
|
|
|
|
282
|
|
|
return $this; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Get mainPicture |
287
|
|
|
* |
288
|
|
|
* @return \Application\Sonata\MediaBundle\Entity\Media |
289
|
|
|
*/ |
290
|
7 |
|
public function getMainPicture() |
291
|
|
|
{ |
292
|
7 |
|
return $this->mainPicture; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* Set mainPicture |
297
|
|
|
* |
298
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\Media $mainPicture |
299
|
|
|
* @return Performance |
300
|
|
|
*/ |
301
|
|
|
public function setMainPicture(\Application\Sonata\MediaBundle\Entity\Media $mainPicture = null) |
302
|
|
|
{ |
303
|
|
|
$this->mainPicture = $mainPicture; |
304
|
|
|
|
305
|
|
|
return $this; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Get sliderImage |
310
|
|
|
* |
311
|
|
|
* @return \Application\Sonata\MediaBundle\Entity\Media |
312
|
|
|
*/ |
313
|
7 |
|
public function getSliderImage() |
314
|
|
|
{ |
315
|
7 |
|
return $this->sliderImage; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Set sliderImage |
320
|
|
|
* |
321
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\Media $sliderImage |
322
|
|
|
* @return Performance |
323
|
|
|
*/ |
324
|
|
|
public function setSliderImage(\Application\Sonata\MediaBundle\Entity\Media $sliderImage = null) |
325
|
|
|
{ |
326
|
|
|
$this->sliderImage = $sliderImage; |
327
|
|
|
|
328
|
|
|
return $this; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* Get slug |
333
|
|
|
* |
334
|
|
|
* @return string |
335
|
|
|
*/ |
336
|
5 |
|
public function getSlug() |
337
|
|
|
{ |
338
|
5 |
|
return $this->slug; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Set slug |
343
|
|
|
* |
344
|
|
|
* @param string $slug |
345
|
|
|
* @return Performance |
346
|
|
|
*/ |
347
|
|
|
public function setSlug($slug) |
348
|
|
|
{ |
349
|
|
|
$this->slug = $slug; |
350
|
|
|
|
351
|
|
|
return $this; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Add performanceEvent |
356
|
|
|
* |
357
|
|
|
* @param \AppBundle\Entity\PerformanceEvent $performanceEvent |
358
|
|
|
* @return Performance |
359
|
|
|
*/ |
360
|
|
|
public function addPerformanceEvent(\AppBundle\Entity\PerformanceEvent $performanceEvent) |
361
|
|
|
{ |
362
|
|
|
$this->performanceEvents[] = $performanceEvent; |
363
|
|
|
|
364
|
|
|
return $this; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Remove performanceEvent |
369
|
|
|
* |
370
|
|
|
* @param \AppBundle\Entity\PerformanceEvent $performanceEvent |
371
|
|
|
*/ |
372
|
|
|
public function removePerformanceEvent(\AppBundle\Entity\PerformanceEvent $performanceEvent) |
373
|
|
|
{ |
374
|
|
|
$this->performanceEvents->removeElement($performanceEvent); |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* Get performanceEvents |
379
|
|
|
* |
380
|
|
|
* @return \Doctrine\Common\Collections\Collection |
381
|
|
|
*/ |
382
|
2 |
|
public function getPerformanceEvents() |
383
|
|
|
{ |
384
|
2 |
|
return $this->performanceEvents; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* Add role |
389
|
|
|
* |
390
|
|
|
* @param \AppBundle\Entity\Role $role |
391
|
|
|
* @return Performance |
392
|
|
|
*/ |
393
|
|
|
public function addRole(\AppBundle\Entity\Role $role) |
394
|
|
|
{ |
395
|
|
|
$role->setPerformance($this); |
396
|
|
|
$this->roles[] = $role; |
397
|
|
|
|
398
|
|
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* Remove role |
403
|
|
|
* |
404
|
|
|
* @param \AppBundle\Entity\Role $role |
405
|
|
|
*/ |
406
|
|
|
public function removeRole(\AppBundle\Entity\Role $role) |
407
|
|
|
{ |
408
|
|
|
$this->roles->removeElement($role); |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** |
412
|
|
|
* Get roles |
413
|
|
|
* |
414
|
|
|
* @return \Doctrine\Common\Collections\Collection |
415
|
|
|
*/ |
416
|
2 |
|
public function getRoles() |
417
|
|
|
{ |
418
|
2 |
|
return $this->roles; |
419
|
|
|
} |
420
|
|
|
|
421
|
1 |
|
public function __toString() |
422
|
|
|
{ |
423
|
1 |
|
return $this->getTitle(); |
424
|
|
|
} |
425
|
|
|
|
426
|
|
|
/** |
427
|
|
|
* Get title |
428
|
|
|
* |
429
|
|
|
* @return string |
430
|
|
|
*/ |
431
|
1 |
|
public function getTitle() |
432
|
|
|
{ |
433
|
1 |
|
return $this->title; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* Set title |
438
|
|
|
* |
439
|
|
|
* @param string $title |
440
|
|
|
* @return Performance |
441
|
|
|
*/ |
442
|
|
|
public function setTitle($title) |
443
|
|
|
{ |
444
|
|
|
$this->title = $title; |
445
|
|
|
|
446
|
|
|
return $this; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* Add galleryHasMedia |
451
|
|
|
* |
452
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
453
|
|
|
* @return Performance |
454
|
|
|
*/ |
455
|
|
|
public function addGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
456
|
|
|
{ |
457
|
|
|
$this->galleryHasMedia[] = $galleryHasMedia; |
458
|
|
|
|
459
|
|
|
return $this; |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Remove galleryHasMedia |
464
|
|
|
* |
465
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
466
|
|
|
*/ |
467
|
|
|
public function removeGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
468
|
|
|
{ |
469
|
|
|
$this->galleryHasMedia->removeElement($galleryHasMedia); |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* Get galleryHasMedia |
474
|
|
|
* |
475
|
|
|
* @return \Doctrine\Common\Collections\Collection |
476
|
|
|
*/ |
477
|
6 |
|
public function getGalleryHasMedia() |
478
|
|
|
{ |
479
|
6 |
|
return $this->galleryHasMedia; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* @return History |
484
|
|
|
*/ |
485
|
|
|
public function getFestival() |
486
|
|
|
{ |
487
|
|
|
return $this->festival; |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
/** |
491
|
|
|
* @param History $festival |
492
|
|
|
* @return $this |
493
|
|
|
*/ |
494
|
|
|
public function setFestival($festival) |
495
|
|
|
{ |
496
|
|
|
$this->festival = $festival; |
497
|
|
|
|
498
|
|
|
return $this; |
499
|
|
|
} |
500
|
|
|
} |
501
|
|
|
|