> */ #[ORM\Column(type: Types::JSON)] private array $details = []; /** * The request body as received. Mapped keys this application does not know yet are ignored * on the way in (§3.2) and the TYPO3 side widens a form's mapping without a release here, * so without this copy those answers would be lost for good instead of backfillable. * * @var array */ #[ORM\Column(type: Types::JSON)] private array $payload = []; public function __construct(string $form, string $formLabel, \DateTimeImmutable $submittedAt) { $this->uuid = Uuid::v4(); $this->form = $form; $this->formLabel = $formLabel; $this->submittedAt = $submittedAt; } /** * The validated payload as a row. Called with a DTO that passed validation - submittedAt is * parseable by then, which is why the constructor can insist on a date. * * The raw payload is passed in separately because the DTO no longer has it: the resolver * drops every key the DTO has no property for, and those are the mapped fields the TYPO3 * side has added and this application does not know yet (§3.2). Keeping the body is what * makes them backfillable instead of lost. * * @param array $payload */ public static function fromDto(ApplicationFormSubmissionDto $dto, array $payload = []): self { $submission = new self($dto->form, $dto->formLabel, $dto->getSubmittedAt()); return $submission ->setPageUid($dto->getPageUid()) ->setPageUrl($dto->pageUrl) ->setFirstName($dto->firstName) ->setLastName($dto->lastName) ->setEmail($dto->email) ->setPhone($dto->phone) ->setMobile($dto->mobile) ->setBirthDate($dto->birthDate) ->setStreet($dto->street) ->setZipCode($dto->zipCode) ->setCity($dto->city) ->setDetails($dto->getNormalizedDetails()) ->setPayload($payload) ; } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getForm(): string { return $this->form; } public function getFormLabel(): string { return $this->formLabel; } public function getSubmittedAt(): \DateTimeImmutable { return $this->submittedAt; } public function getPageUid(): ?int { return $this->pageUid; } public function setPageUid(?int $pageUid): static { $this->pageUid = $pageUid; return $this; } public function getPageUrl(): ?string { return $this->pageUrl; } public function setPageUrl(?string $pageUrl): static { $this->pageUrl = $pageUrl; return $this; } 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 getEmail(): ?string { return $this->email; } public function setEmail(?string $email): static { // Same normalization as Contact and Embeddable\Communication: a later match against // existing people has to compare like with like. $this->email = null === $email ? null : mb_strtolower(trim($email)); return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): static { $this->phone = $phone; return $this; } public function getMobile(): ?string { return $this->mobile; } public function setMobile(?string $mobile): static { $this->mobile = $mobile; return $this; } public function getBirthDate(): ?string { return $this->birthDate; } public function setBirthDate(?string $birthDate): static { $this->birthDate = $birthDate; return $this; } public function getStreet(): ?string { return $this->street; } public function setStreet(?string $street): static { $this->street = $street; return $this; } public function getZipCode(): ?string { return $this->zipCode; } public function setZipCode(?string $zipCode): static { $this->zipCode = $zipCode; return $this; } public function getCity(): ?string { return $this->city; } public function setCity(?string $city): static { $this->city = $city; return $this; } public function getFirstMailSentAt(): ?\DateTimeImmutable { return $this->firstMailSentAt; } public function setFirstMailSentAt(?\DateTimeImmutable $firstMailSentAt): static { $this->firstMailSentAt = $firstMailSentAt; return $this; } public function getSecondMailSentAt(): ?\DateTimeImmutable { return $this->secondMailSentAt; } public function setSecondMailSentAt(?\DateTimeImmutable $secondMailSentAt): static { $this->secondMailSentAt = $secondMailSentAt; return $this; } public function getFirstCallHeldAt(): ?\DateTimeImmutable { return $this->firstCallHeldAt; } public function setFirstCallHeldAt(?\DateTimeImmutable $firstCallHeldAt): static { $this->firstCallHeldAt = $firstCallHeldAt; return $this; } public function getSecondCallHeldAt(): ?\DateTimeImmutable { return $this->secondCallHeldAt; } public function setSecondCallHeldAt(?\DateTimeImmutable $secondCallHeldAt): static { $this->secondCallHeldAt = $secondCallHeldAt; return $this; } /** * @return array> */ public function getDetails(): array { return $this->details; } /** * @param array> $details */ public function setDetails(array $details): static { $this->details = $details; return $this; } /** * @return array */ public function getPayload(): array { return $this->payload; } /** * @param array $payload */ public function setPayload(array $payload): static { $this->payload = $payload; return $this; } }