uuid = Uuid::v4(); $this->status = static::STATUS_NEW; $this->availabilities = new ArrayCollection(); $this->feedback = new ArrayCollection(); $this->trainingAttendances = new ArrayCollection(); $this->licenses = new ArrayCollection(); $this->jobProfiles = new ArrayCollection(); $this->bookmarks = new ArrayCollection(); $this->applications = new ArrayCollection(); $this->dispositions = new ArrayCollection(); } public function toPayload(): array { // Transform gender value $gender = strtoupper($this->getGender()); $gender = 'F' === $gender ? 'W' : $gender; // Ensure date of birth is populated if (null === $dob = $this->getDateOfBirth()) { $dob = new \DateTimeImmutable('18 years ago'); } return [ 'geburtsdatum' => $dob->format('d.m.Y'), 'anrede' => $this->getSalutation(), 'geschlecht' => $gender, 'titel' => $this->getAcademicTitle(), 'vorname' => $this->getFirstName(), 'name' => $this->getLastName(), 'anschrift' => $this->getAddress()->toPayload(), 'kommunikation' => $this->getCommunication()->toPayload(), ]; } public static function fromApiResponse(ProfileResponse $profileResponse): static { $instance = new static(); $instance ->setAcademicTitle($profileResponse->getTitle()) ->setSalutation($profileResponse->getSalutation()) ->setFirstName($profileResponse->getFirstName()) ->setLastName($profileResponse->getName()) ->setGender($profileResponse->getGender()) ->setDateOfBirth($profileResponse->getDateOfBirth()) ; $address = Address::fromApiResponse($profileResponse); $communication = Communication::fromApiResponse($profileResponse); $instance ->setAddress($address) ->setCommunication($communication) ; return $instance; } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getFirstName(): ?string { return $this->firstName; } public function setFirstName(?string $firstName): static { $this->firstName = $firstName; return $this; } public function getLastName(): ?string { return $this->lastName; } public function setLastName(?string $lastName): static { $this->lastName = $lastName; return $this; } public function getGender(): ?string { return $this->gender; } public function setGender(?string $gender): static { $this->gender = $gender; return $this; } public function getDateOfBirth(): ?\DateTimeImmutable { return $this->dateOfBirth; } public function setDateOfBirth(?\DateTimeImmutable $dateOfBirth): static { $this->dateOfBirth = $dateOfBirth; return $this; } public function getAcademicTitle(): ?string { return $this->academicTitle; } public function setAcademicTitle(?string $academicTitle): static { $this->academicTitle = $academicTitle; return $this; } public function getSalutation(): ?string { return $this->salutation; } public function setSalutation(?string $salutation): static { $this->salutation = $salutation; return $this; } public function getNationality(): ?string { return $this->nationality; } public function setNationality(?string $nationality): static { $this->nationality = $nationality; return $this; } public function getAddress(): ?Address { return $this->address; } public function setAddress(?Address $address): static { $this->address = $address; return $this; } public function getCommunication(): ?Communication { return $this->communication; } public function setCommunication(?Communication $communication): static { $this->communication = $communication; return $this; } public function getBankAccount(): ?BankAccount { return $this->bankAccount; } public function setBankAccount(?BankAccount $bankAccount): static { $this->bankAccount = $bankAccount; return $this; } public function getTaxId(): ?string { return $this->taxId; } public function setTaxId(?string $taxId): static { $this->taxId = $taxId; return $this; } public function getHealthInsuranceCompany(): ?string { return $this->healthInsuranceCompany; } public function setHealthInsuranceCompany(?string $healthInsuranceCompany): static { $this->healthInsuranceCompany = $healthInsuranceCompany; return $this; } public function getStatus(): ?string { return $this->status; } public function setStatus(string $status): static { $this->status = $status; return $this; } public function getRemarks(): ?string { return $this->remarks; } public function setRemarks(?string $remarks): static { $this->remarks = $remarks; return $this; } /** * @return Collection */ public function getAvailabilities(): Collection { return $this->availabilities; } public function addAvailability(Availability $availability): static { if (!$this->availabilities->contains($availability)) { $this->availabilities->add($availability); $availability->setOwner($this); } return $this; } public function removeAvailability(Availability $availability): static { if ($this->availabilities->removeElement($availability)) { // set the owning side to null (unless already changed) if ($availability->getOwner() === $this) { $availability->setOwner(null); } } return $this; } public function getPhoto(): ?Upload { return $this->photo; } public function setPhoto(?Upload $photo): static { $this->photo = $photo; return $this; } /** * @return Collection */ public function getFeedback(): Collection { return $this->feedback; } public function addFeedback(Feedback $feedback): static { if (!$this->feedback->contains($feedback)) { $this->feedback->add($feedback); $feedback->setTeamer($this); } return $this; } public function removeFeedback(Feedback $feedback): static { if ($this->feedback->removeElement($feedback)) { // set the owning side to null (unless already changed) if ($feedback->getTeamer() === $this) { $feedback->setTeamer(null); } } return $this; } /** * @return Collection */ public function getTrainingAttendances(): Collection { return $this->trainingAttendances; } public function addTrainingAttendance(TrainingAttendance $trainingAttendance): static { if (!$this->trainingAttendances->contains($trainingAttendance)) { $this->trainingAttendances->add($trainingAttendance); $trainingAttendance->setTeamer($this); } return $this; } public function removeTrainingAttendance(TrainingAttendance $trainingAttendance): static { if ($this->trainingAttendances->removeElement($trainingAttendance)) { // set the owning side to null (unless already changed) if ($trainingAttendance->getTeamer() === $this) { $trainingAttendance->setTeamer(null); } } return $this; } /** * @return Collection */ public function getLicenses(): Collection { return $this->licenses; } public function addLicense(License $license): static { if (!$this->licenses->contains($license)) { $this->licenses->add($license); $license->setTeamer($this); } return $this; } public function removeLicense(License $license): static { if ($this->licenses->removeElement($license)) { // set the owning side to null (unless already changed) if ($license->getTeamer() === $this) { $license->setTeamer(null); } } return $this; } public function hasLicenseOfType(string $type): bool { foreach ($this->getLicenses() as $license) { if ($type === $license->getType()) { return true; } } return false; } /** * @return Collection */ public function getJobProfiles(): Collection { return $this->jobProfiles; } public function addJobProfile(JobProfile $jobProfile): static { if (!$this->jobProfiles->contains($jobProfile)) { $this->jobProfiles->add($jobProfile); } return $this; } public function removeJobProfile(JobProfile $jobProfile): static { $this->jobProfiles->removeElement($jobProfile); return $this; } /** * @return Collection */ public function getBookmarks(): Collection { return $this->bookmarks; } public function addBookmark(Assignment $bookmark): static { if (!$this->bookmarks->contains($bookmark)) { $this->bookmarks->add($bookmark); } return $this; } public function removeBookmark(Assignment $bookmark): static { $this->bookmarks->removeElement($bookmark); return $this; } /** * @return Collection */ public function getApplications(): Collection { return $this->applications; } public function addApplication(Application $application): static { if (!$this->applications->contains($application)) { $this->applications->add($application); $application->setTeamer($this); } return $this; } public function removeApplication(Application $application): static { if ($this->applications->removeElement($application)) { // set the owning side to null (unless already changed) if ($application->getTeamer() === $this) { $application->setTeamer(null); } } return $this; } /** * @return Collection */ public function getDispositions(): Collection { return $this->dispositions; } public function addDisposition(Disposition $disposition): static { if (!$this->dispositions->contains($disposition)) { $this->dispositions->add($disposition); $disposition->setTeamer($this); } return $this; } public function removeDisposition(Disposition $disposition): static { if ($this->dispositions->removeElement($disposition)) { // set the owning side to null (unless already changed) if ($disposition->getTeamer() === $this) { $disposition->setTeamer(null); } } return $this; } }