WIP: Implement profile editing

This commit is contained in:
Björn Fromme
2023-09-17 19:36:18 +02:00
parent 97c5a686af
commit bfc5e5e242
17 changed files with 498 additions and 18 deletions
+22
View File
@@ -117,6 +117,28 @@ class Teamer implements TimestampableEntityInterface
$this->dispositions = new ArrayCollection();
}
public function toPayload(): array
{
// Transform gender value
$gender = strtoupper($this->getGender());
$gender = 'F' ? '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'),
'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();