1 | <?php |
||
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 ArrayCollection|Role[] |
||
113 | * |
||
114 | * @ORM\OneToMany( |
||
115 | * targetEntity="AppBundle\Entity\Role", |
||
116 | * mappedBy="employee", |
||
117 | * cascade={"persist", "remove"}, |
||
118 | * orphanRemoval=true |
||
119 | * ) |
||
120 | */ |
||
121 | private $roles; |
||
122 | |||
123 | /** |
||
124 | * @var ArrayCollection|GalleryHasMedia[] |
||
125 | * |
||
126 | * @ORM\ManyToMany(targetEntity="Application\Sonata\MediaBundle\Entity\GalleryHasMedia", cascade={"persist"}) |
||
127 | * @ORM\JoinTable(name="employee_galleryHasMedia", |
||
128 | * joinColumns={@ORM\JoinColumn(name="employee_id",referencedColumnName="id")}, |
||
129 | * inverseJoinColumns={@ORM\JoinColumn(name="galleryHasMedia_id",referencedColumnName="id")} |
||
130 | * ) |
||
131 | */ |
||
132 | private $galleryHasMedia; |
||
133 | |||
134 | /** |
||
135 | * @var array |
||
136 | * @Expose |
||
137 | * @Type("array") |
||
138 | * @SerializedName("gallery") |
||
139 | */ |
||
140 | public $galleryHasMediaThumbnails; |
||
141 | |||
142 | /** |
||
143 | * @Gedmo\Slug(fields={"firstName", "lastName"}) |
||
144 | * @ORM\Column(name="slug", type="string", length=255) |
||
145 | * @Type("string") |
||
146 | * @Expose |
||
147 | */ |
||
148 | private $slug; |
||
149 | |||
150 | /** |
||
151 | * @var |
||
152 | * |
||
153 | * @ORM\OneToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}) |
||
154 | * @ORM\JoinColumn(name="avatar_id", referencedColumnName="id") |
||
155 | */ |
||
156 | private $avatar; |
||
157 | |||
158 | /** |
||
159 | * @var array |
||
160 | * @Expose |
||
161 | * @Type("array") |
||
162 | * @SerializedName("avatar") |
||
163 | */ |
||
164 | public $avatarThumbnails; |
||
165 | |||
166 | /** |
||
167 | * @var ArrayCollection|EmployeeTranslation[] |
||
168 | * |
||
169 | * @ORM\OneToMany( |
||
170 | * targetEntity="AppBundle\Entity\Translations\EmployeeTranslation", |
||
171 | * mappedBy="object", |
||
172 | * cascade={"persist", "remove"} |
||
173 | * ) |
||
174 | */ |
||
175 | protected $translations; |
||
176 | |||
177 | /** |
||
178 | * Constructor |
||
179 | */ |
||
180 | 1 | public function __construct() |
|
181 | { |
||
182 | 1 | parent::__construct(); |
|
183 | 1 | $this->roles = new ArrayCollection(); |
|
184 | 1 | $this->galleryHasMedia = new ArrayCollection(); |
|
185 | 1 | } |
|
186 | |||
187 | /** |
||
188 | * Unset translations |
||
189 | * |
||
190 | * @return Employee |
||
191 | */ |
||
192 | 5 | public function unsetTranslations() |
|
198 | |||
199 | /** |
||
200 | * Get id |
||
201 | * |
||
202 | * @return integer |
||
203 | */ |
||
204 | 2 | public function getId() |
|
208 | |||
209 | /** |
||
210 | * Get firstName |
||
211 | * |
||
212 | * @return string |
||
213 | */ |
||
214 | 6 | public function getFirstName() |
|
215 | { |
||
216 | 6 | return $this->firstName; |
|
217 | } |
||
218 | |||
219 | /** |
||
220 | * Set firstName |
||
221 | * |
||
222 | * @param string $firstName |
||
223 | * @return Employee |
||
224 | */ |
||
225 | public function setFirstName($firstName) |
||
226 | { |
||
227 | $this->firstName = $firstName; |
||
228 | |||
229 | return $this; |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * Get lastName |
||
234 | * |
||
235 | * @return string |
||
236 | */ |
||
237 | 6 | public function getLastName() |
|
238 | { |
||
239 | 6 | return $this->lastName; |
|
240 | } |
||
241 | |||
242 | /** |
||
243 | * Set lastName |
||
244 | * |
||
245 | * @param string $lastName |
||
246 | * @return Employee |
||
247 | */ |
||
248 | public function setLastName($lastName) |
||
249 | { |
||
250 | $this->lastName = $lastName; |
||
251 | |||
252 | return $this; |
||
253 | } |
||
254 | |||
255 | /** |
||
256 | * Get dob |
||
257 | * |
||
258 | * @return \DateTime |
||
259 | */ |
||
260 | 3 | public function getDob() |
|
264 | |||
265 | /** |
||
266 | * Set dob |
||
267 | * |
||
268 | * @param \DateTime $dob |
||
269 | * @return Employee |
||
270 | */ |
||
271 | public function setDob($dob) |
||
277 | |||
278 | /** |
||
279 | * Get position |
||
280 | * |
||
281 | * @return string |
||
282 | */ |
||
283 | 7 | public function getPosition() |
|
287 | |||
288 | /** |
||
289 | * Set position |
||
290 | * |
||
291 | * @param string $position |
||
292 | * @return Employee |
||
293 | */ |
||
294 | 4 | public function setPosition($position) |
|
300 | |||
301 | /** |
||
302 | * Get biography |
||
303 | * |
||
304 | * @return string |
||
305 | */ |
||
306 | 1 | public function getBiography() |
|
310 | |||
311 | /** |
||
312 | * Set biography |
||
313 | * |
||
314 | * @param string $biography |
||
315 | * @return Employee |
||
316 | */ |
||
317 | public function setBiography($biography) |
||
323 | |||
324 | /** |
||
325 | * Add role |
||
326 | * |
||
327 | * @param Role $role |
||
328 | * @return Employee |
||
329 | */ |
||
330 | public function addRole(Role $role) |
||
336 | |||
337 | /** |
||
338 | * Remove role |
||
339 | * |
||
340 | * @param Role $role |
||
341 | */ |
||
342 | public function removeRole(Role $role) |
||
346 | |||
347 | /** |
||
348 | * Get roles |
||
349 | * |
||
350 | * @return \Doctrine\Common\Collections\Collection |
||
351 | */ |
||
352 | 3 | public function getRoles() |
|
356 | |||
357 | 5 | public function __toString() |
|
358 | { |
||
359 | 5 | return $this->getFirstName().' '.$this->getLastName(); |
|
360 | } |
||
361 | |||
362 | /** |
||
363 | * Get slug |
||
364 | * |
||
365 | * @return string |
||
366 | */ |
||
367 | 2 | public function getSlug() |
|
368 | { |
||
369 | 2 | return $this->slug; |
|
370 | } |
||
371 | |||
372 | /** |
||
373 | * Set slug |
||
374 | * |
||
375 | * @param string $slug |
||
376 | * @return Employee |
||
377 | */ |
||
378 | public function setSlug($slug) |
||
384 | |||
385 | /** |
||
386 | * @return mixed |
||
387 | */ |
||
388 | 7 | public function getAvatar() |
|
392 | |||
393 | /** |
||
394 | * @param mixed $avatar |
||
395 | * @return $this |
||
396 | */ |
||
397 | public function setAvatar($avatar) |
||
403 | |||
404 | 3 | public static function getPositions() |
|
433 | |||
434 | /** |
||
435 | * Add galleryHasMedia |
||
436 | * |
||
437 | * @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
||
438 | * @return Employee |
||
439 | */ |
||
440 | public function addGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
||
446 | |||
447 | /** |
||
448 | * Remove galleryHasMedia |
||
449 | * |
||
450 | * @param \Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia |
||
451 | */ |
||
452 | public function removeGalleryHasMedia(\Application\Sonata\MediaBundle\Entity\GalleryHasMedia $galleryHasMedia) |
||
456 | |||
457 | /** |
||
458 | * Get galleryHasMedia |
||
459 | * |
||
460 | * @return \Doctrine\Common\Collections\Collection |
||
461 | */ |
||
462 | 4 | public function getGalleryHasMedia() |
|
466 | } |
||
467 |