1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
7
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
8
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
9
|
|
|
use AppBundle\Traits\TimestampableTrait; |
10
|
|
|
use AppBundle\Traits\DeletedByTrait; |
11
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
12
|
|
|
use JMS\Serializer\Annotation\Expose; |
13
|
|
|
use JMS\Serializer\Annotation\Type; |
14
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
15
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface; |
16
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @ORM\Table(name="employees") |
20
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\EmployeeRepository") |
21
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
22
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\EmployeeTranslation") |
23
|
|
|
* @ExclusionPolicy("all") |
24
|
|
|
*/ |
25
|
|
|
class Employee extends AbstractPersonalTranslatable implements TranslatableInterface |
26
|
|
|
{ |
27
|
|
|
use TimestampableTrait, BlameableEntity, DeletedByTrait; |
28
|
|
|
|
29
|
|
|
const POSITION_ACTOR = 'actor'; |
30
|
|
|
const POSITION_ACTRESS = 'actress'; |
31
|
|
|
const POSITION_THEATRE_DIRECTOR = 'theatre_director'; // |
32
|
|
|
const POSITION_THEATRE_DIRECTOR_ART_DIRECTOR = 'theatre_director_art_director'; // |
33
|
|
|
const POSITION_ACTING_ARTISTIC_DIRECTOR = 'acting_artistic_director'; // |
34
|
|
|
const POSITION_PRODUCTION_DIRECTOR = 'production_director'; |
35
|
|
|
const POSITION_MAIN_ARTIST = 'main_artist'; |
36
|
|
|
const POSITION_COSTUMER = 'costumer'; |
37
|
|
|
const POSITION_ARTISTIC_DIRECTOR = 'artistic_director'; |
38
|
|
|
const POSITION_MAIN_CHOREOGPAPHER = 'main_choreographer'; |
39
|
|
|
const POSITION_HEAD_OF_THE_LITERARY_AND_DRAMATIC_PART = 'head_of_the_literary_and_dramatic_part'; |
40
|
|
|
const POSITION_CONDUCTOR = 'conductor'; |
41
|
|
|
const POSITION_ACCOMPANIST = 'accompanist'; |
42
|
|
|
const POSITION_HEAD_CHOREOGRAPHER = 'head_choreographer'; |
43
|
|
|
const POSITION_ART_DIRECTOR = 'art_director'; |
44
|
|
|
const POSITION_STAGED = 'staged'; |
45
|
|
|
const POSITION_ACCOMPANIST_SINGING_CLASS = 'accompanist_singing_class'; |
46
|
|
|
const POSITION_HEAD_OF_TROUPE = 'head_of_troupe'; |
47
|
|
|
const POSITION_HEAD_OF_ARTISTIC_STAGING_PART = 'head_of_artistic_staging_part'; |
48
|
|
|
const POSITION_STAGE_MANAGER = 'stage_manager'; |
49
|
|
|
const POSITION_LEADING_ARTIST_SCENE = 'leading_artist_scene'; |
50
|
|
|
const POSITION_ACTOR_HIGHER_CATEGORY = 'actor_higher_category'; |
51
|
|
|
const POSITION_ACTOR_FIRST_CATEGORY = 'actor_first_category'; |
52
|
|
|
const POSITION_ACTOR_SINGER_SOLOIST_HIGHER_CATEGORY = 'actor_singer_soloist_higher_category'; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var integer |
56
|
|
|
* @ORM\Column(name="id", type="integer") |
57
|
|
|
* @ORM\Id |
58
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
59
|
|
|
*/ |
60
|
|
|
private $id; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var string |
64
|
|
|
* @Gedmo\Translatable |
65
|
|
|
* @Assert\NotBlank() |
66
|
|
|
* @ORM\Column(type="string", length=255) |
67
|
|
|
* @Type("string") |
68
|
|
|
* @Expose |
69
|
|
|
*/ |
70
|
|
|
private $firstName; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var string |
74
|
|
|
* @Gedmo\Translatable |
75
|
|
|
* @Assert\NotBlank() |
76
|
|
|
* @ORM\Column(type="string", length=255) |
77
|
|
|
* @Type("string") |
78
|
|
|
* @Expose |
79
|
|
|
*/ |
80
|
|
|
private $lastName; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var /Datetime |
84
|
|
|
* @Assert\NotBlank() |
85
|
|
|
* @ORM\Column(type="datetime") |
86
|
|
|
* @Type("DateTime") |
87
|
|
|
* @Expose |
88
|
|
|
*/ |
89
|
|
|
private $dob; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string |
93
|
|
|
* @ORM\Column(type="string", length=255) |
94
|
|
|
* @Type("string") |
95
|
|
|
* @Expose |
96
|
|
|
*/ |
97
|
|
|
private $position; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @var string |
101
|
|
|
* @Gedmo\Translatable |
102
|
|
|
* @ORM\Column(type="text", nullable=true) |
103
|
|
|
* @Type("string") |
104
|
|
|
* @Expose |
105
|
|
|
*/ |
106
|
|
|
private $biography; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var Role[] |
110
|
|
|
* |
111
|
|
|
* @ORM\OneToMany( |
112
|
|
|
* targetEntity="AppBundle\Entity\Role", |
113
|
|
|
* mappedBy="employee", |
114
|
|
|
* cascade={"persist", "remove"}, |
115
|
|
|
* orphanRemoval=true |
116
|
|
|
* ) |
117
|
|
|
*/ |
118
|
|
|
private $roles; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var \Application\Sonata\MediaBundle\Entity\GalleryHasMedia |
122
|
|
|
* |
123
|
|
|
* @ORM\ManyToMany(targetEntity="Application\Sonata\MediaBundle\Entity\GalleryHasMedia", cascade={"persist"}) |
124
|
|
|
* @ORM\JoinTable(name="employee_galleryHasMedia", |
125
|
|
|
* joinColumns={@ORM\JoinColumn(name="employee_id",referencedColumnName="id")}, |
126
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="galleryHasMedia_id",referencedColumnName="id")} |
127
|
|
|
* ) |
128
|
|
|
*/ |
129
|
|
|
private $galleryHasMedia; |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @var array |
133
|
|
|
* @Expose |
134
|
|
|
* @Type("array") |
135
|
|
|
* @SerializedName("gallery") |
136
|
|
|
*/ |
137
|
|
|
public $galleryHasMediaThumbnails; |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @Gedmo\Slug(fields={"firstName", "lastName"}) |
141
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
142
|
|
|
* @Type("string") |
143
|
|
|
* @Expose |
144
|
|
|
*/ |
145
|
|
|
private $slug; |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @var |
149
|
|
|
* |
150
|
|
|
* @ORM\OneToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}) |
151
|
|
|
* @ORM\JoinColumn(name="avatar_id", referencedColumnName="id") |
152
|
|
|
*/ |
153
|
|
|
private $avatar; |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @var array |
157
|
|
|
* @Expose |
158
|
|
|
* @Type("array") |
159
|
|
|
* @SerializedName("avatar") |
160
|
|
|
*/ |
161
|
|
|
public $avatarThumbnails; |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @var ArrayCollection |
165
|
|
|
* |
166
|
|
|
* @ORM\OneToMany( |
167
|
|
|
* targetEntity="AppBundle\Entity\Translations\EmployeeTranslation", |
168
|
|
|
* mappedBy="object", |
169
|
|
|
* cascade={"persist", "remove"} |
170
|
|
|
* ) |
171
|
|
|
*/ |
172
|
|
|
protected $translations; |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Constructor |
176
|
|
|
*/ |
177
|
|
|
public function __construct() |
178
|
|
|
{ |
179
|
|
|
parent::__construct(); |
180
|
|
|
$this->roles = new \Doctrine\Common\Collections\ArrayCollection(); |
181
|
|
|
$this->galleryHasMedia = new \Doctrine\Common\Collections\ArrayCollection(); |
|
|
|
|
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Unset translations |
186
|
|
|
* |
187
|
|
|
* @return Employee |
188
|
|
|
*/ |
189
|
5 |
|
public function unsetTranslations() |
190
|
|
|
{ |
191
|
5 |
|
$this->translations = null; |
192
|
|
|
|
193
|
5 |
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Get id |
198
|
|
|
* |
199
|
|
|
* @return integer |
200
|
|
|
*/ |
201
|
1 |
|
public function getId() |
202
|
|
|
{ |
203
|
1 |
|
return $this->id; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Get firstName |
208
|
|
|
* |
209
|
|
|
* @return string |
210
|
|
|
*/ |
211
|
1 |
|
public function getFirstName() |
212
|
|
|
{ |
213
|
1 |
|
return $this->firstName; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Set firstName |
218
|
|
|
* |
219
|
|
|
* @param string $firstName |
220
|
|
|
* @return Employee |
221
|
|
|
*/ |
222
|
|
|
public function setFirstName($firstName) |
223
|
|
|
{ |
224
|
|
|
$this->firstName = $firstName; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* Get lastName |
231
|
|
|
* |
232
|
|
|
* @return string |
233
|
|
|
*/ |
234
|
1 |
|
public function getLastName() |
235
|
|
|
{ |
236
|
1 |
|
return $this->lastName; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* Set lastName |
241
|
|
|
* |
242
|
|
|
* @param string $lastName |
243
|
|
|
* @return Employee |
244
|
|
|
*/ |
245
|
|
|
public function setLastName($lastName) |
246
|
|
|
{ |
247
|
|
|
$this->lastName = $lastName; |
248
|
|
|
|
249
|
|
|
return $this; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* Get dob |
254
|
|
|
* |
255
|
|
|
* @return \DateTime |
256
|
|
|
*/ |
257
|
|
|
public function getDob() |
258
|
|
|
{ |
259
|
|
|
return $this->dob; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Set dob |
264
|
|
|
* |
265
|
|
|
* @param \DateTime $dob |
266
|
|
|
* @return Employee |
267
|
|
|
*/ |
268
|
|
|
public function setDob($dob) |
269
|
|
|
{ |
270
|
|
|
$this->dob = $dob; |
271
|
|
|
|
272
|
|
|
return $this; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Get position |
277
|
|
|
* |
278
|
|
|
* @return string |
279
|
|
|
*/ |
280
|
4 |
|
public function getPosition() |
281
|
|
|
{ |
282
|
4 |
|
return $this->position; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Set position |
287
|
|
|
* |
288
|
|
|
* @param string $position |
289
|
|
|
* @return Employee |
290
|
|
|
*/ |
291
|
4 |
|
public function setPosition($position) |
292
|
|
|
{ |
293
|
4 |
|
$this->position = $position; |
294
|
|
|
|
295
|
4 |
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Get biography |
300
|
|
|
* |
301
|
|
|
* @return string |
302
|
|
|
*/ |
303
|
|
|
public function getBiography() |
304
|
|
|
{ |
305
|
|
|
return $this->biography; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Set biography |
310
|
|
|
* |
311
|
|
|
* @param string $biography |
312
|
|
|
* @return Employee |
313
|
|
|
*/ |
314
|
|
|
public function setBiography($biography) |
315
|
|
|
{ |
316
|
|
|
$this->biography = $biography; |
317
|
|
|
|
318
|
|
|
return $this; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* Add role |
323
|
|
|
* |
324
|
|
|
* @param \AppBundle\Entity\Role $role |
325
|
|
|
* @return Employee |
326
|
|
|
*/ |
327
|
|
|
public function addRole(\AppBundle\Entity\Role $role) |
328
|
|
|
{ |
329
|
|
|
$this->roles[] = $role; |
330
|
|
|
|
331
|
|
|
return $this; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Remove role |
336
|
|
|
* |
337
|
|
|
* @param \AppBundle\Entity\Role $role |
338
|
|
|
*/ |
339
|
|
|
public function removeRole(\AppBundle\Entity\Role $role) |
340
|
|
|
{ |
341
|
|
|
$this->roles->removeElement($role); |
|
|
|
|
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Get roles |
346
|
|
|
* |
347
|
|
|
* @return \Doctrine\Common\Collections\Collection |
348
|
|
|
*/ |
349
|
2 |
|
public function getRoles() |
350
|
|
|
{ |
351
|
2 |
|
return $this->roles; |
352
|
|
|
} |
353
|
|
|
|
354
|
1 |
|
public function __toString() |
355
|
|
|
{ |
356
|
1 |
|
return $this->getFirstName().' '.$this->getLastName(); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* Get slug |
361
|
|
|
* |
362
|
|
|
* @return string |
363
|
|
|
*/ |
364
|
2 |
|
public function getSlug() |
365
|
|
|
{ |
366
|
2 |
|
return $this->slug; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* Set slug |
371
|
|
|
* |
372
|
|
|
* @param string $slug |
373
|
|
|
* @return Employee |
374
|
|
|
*/ |
375
|
|
|
public function setSlug($slug) |
376
|
|
|
{ |
377
|
|
|
$this->slug = $slug; |
378
|
|
|
|
379
|
|
|
return $this; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @return mixed |
384
|
|
|
*/ |
385
|
4 |
|
public function getAvatar() |
386
|
|
|
{ |
387
|
4 |
|
return $this->avatar; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @param mixed $avatar |
392
|
|
|
* @return $this |
393
|
|
|
*/ |
394
|
|
|
public function setAvatar($avatar) |
395
|
|
|
{ |
396
|
|
|
$this->avatar = $avatar; |
397
|
|
|
|
398
|
|
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
public static function getPositions() |
402
|
|
|
{ |
403
|
|
|
return [ |
404
|
|
|
self::POSITION_ACTOR => 'actor', |
405
|
|
|
self::POSITION_ACTRESS => 'actress', |
406
|
|
|
self::POSITION_THEATRE_DIRECTOR => 'theatre_director', |
407
|
|
|
self::POSITION_THEATRE_DIRECTOR_ART_DIRECTOR => 'theatre_director_art_director', |
408
|
|
|
self::POSITION_ACTING_ARTISTIC_DIRECTOR => 'acting_artistic_director', |
409
|
|
|
self::POSITION_PRODUCTION_DIRECTOR => 'production_director', |
410
|
|
|
self::POSITION_MAIN_ARTIST => 'main_artist', |
411
|
|
|
self::POSITION_COSTUMER => 'costumer', |
412
|
|
|
self::POSITION_ARTISTIC_DIRECTOR => 'artistic_director', |
413
|
|
|
self::POSITION_MAIN_CHOREOGPAPHER => 'main_choreographer', |
414
|
|
|
self::POSITION_HEAD_OF_THE_LITERARY_AND_DRAMATIC_PART => 'head_of_the_literary_and_dramatic_part', |
415
|
|
|
self::POSITION_CONDUCTOR => 'conductor', |
416
|
|
|
self::POSITION_ACCOMPANIST => 'accompanist', |
417
|
|
|
self::POSITION_HEAD_CHOREOGRAPHER => 'head_choreographer', |
418
|
|
|
self::POSITION_ART_DIRECTOR => 'art_director', |
419
|
|
|
self::POSITION_STAGED => 'staged', |
420
|
|
|
self::POSITION_ACCOMPANIST_SINGING_CLASS => 'accompanist_singing_class', |
421
|
|
|
self::POSITION_HEAD_OF_TROUPE => 'head_of_troupe', |
422
|
|
|
self::POSITION_HEAD_OF_ARTISTIC_STAGING_PART => 'head_of_artistic_staging_part', |
423
|
|
|
self::POSITION_STAGE_MANAGER => 'stage_manager', |
424
|
|
|
self::POSITION_LEADING_ARTIST_SCENE => 'leading_artist_scene', |
425
|
|
|
self::POSITION_ACTOR_HIGHER_CATEGORY => 'actor_higher_category', |
426
|
|
|
self::POSITION_ACTOR_FIRST_CATEGORY => 'actor_first_category', |
427
|
|
|
self::POSITION_ACTOR_SINGER_SOLOIST_HIGHER_CATEGORY => 'actor_singer_soloist_higher_category', |
428
|
|
|
]; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* Add galleryHasMedia |
433
|
|
|
* |
434
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
435
|
|
|
* @return Employee |
436
|
|
|
*/ |
437
|
|
|
public function addGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
438
|
|
|
{ |
439
|
|
|
$this->galleryHasMedia[] = $galleryHasMedia; |
440
|
|
|
|
441
|
|
|
return $this; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* Remove galleryHasMedia |
446
|
|
|
* |
447
|
|
|
* @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
448
|
|
|
*/ |
449
|
|
|
public function removeGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
450
|
|
|
{ |
451
|
|
|
$this->galleryHasMedia->removeElement($galleryHasMedia); |
|
|
|
|
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* Get galleryHasMedia |
456
|
|
|
* |
457
|
|
|
* @return \Doctrine\Common\Collections\Collection |
458
|
|
|
*/ |
459
|
3 |
|
public function getGalleryHasMedia() |
460
|
|
|
{ |
461
|
3 |
|
return $this->galleryHasMedia; |
462
|
|
|
} |
463
|
|
|
} |
464
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..