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