wip: submit booking to api
This commit is contained in:
@@ -16,6 +16,7 @@ class ParticipantValidator extends ConstraintValidator
|
||||
$this->assertBodyMeasurementsValid($participant);
|
||||
$this->assertTransportationSelected($participant);
|
||||
$this->assertPickupSelected($participant);
|
||||
$this->assertApplicantAddressValid($participant);
|
||||
}
|
||||
|
||||
public function assertBodyMeasurementsValid(ParticipantDto $participant): void
|
||||
@@ -64,4 +65,49 @@ class ParticipantValidator extends ConstraintValidator
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public function assertApplicantAddressValid(ParticipantDto $participant): void
|
||||
{
|
||||
// Address is only mandatory for the applicant (first participant)
|
||||
if (false === $participant->isApplicant()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check each required address field for applicant
|
||||
if (null === $participant->address->street || '' === trim($participant->address->street)) {
|
||||
$this->context->buildViolation('Bitte angeben')
|
||||
->atPath('address.street')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
if (null === $participant->address->postCode || '' === trim($participant->address->postCode)) {
|
||||
$this->context->buildViolation('Bitte angeben')
|
||||
->atPath('address.postCode')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
if (null === $participant->address->city || '' === trim($participant->address->city)) {
|
||||
$this->context->buildViolation('Bitte angeben')
|
||||
->atPath('address.city')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
if (null === $participant->address->country || '' === trim($participant->address->country)) {
|
||||
$this->context->buildViolation('Bitte angeben')
|
||||
->atPath('address.country')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
// Mobile/phone is mandatory for applicant
|
||||
if (null === $participant->mobile || '' === trim($participant->mobile)) {
|
||||
$this->context->buildViolation('Bitte angeben')
|
||||
->atPath('mobile')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user