Completed
Pull Request — master (#124)
by
unknown
14:32
created

Performance::setDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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