diff --git a/src/Form/Model/ParticipantEditDto.php b/src/Form/Model/ParticipantEditDto.php index 608a355..96bcc32 100644 --- a/src/Form/Model/ParticipantEditDto.php +++ b/src/Form/Model/ParticipantEditDto.php @@ -121,15 +121,22 @@ class ParticipantEditDto } /** - * Validates that adult participants have unique email addresses. + * Validates that non-applicant adult participants have unique email addresses. * - * Children (under 16) are exempt from this validation and can share - * email addresses with adults. Email comparison is case-insensitive - * and whitespace is normalized. + * Exempt from validation: + * - Applicant (index 0): Can share email with dependents they're booking for + * - Children (under 16): Can share email addresses with adults + * + * Email comparison is case-insensitive and whitespace is normalized. */ #[Assert\Callback(groups: ['booking_create', 'booking_edit'])] public function validateEmailUniqueness(ExecutionContextInterface $context): void { + // Skip validation for applicant (index 0) - applicant's email can be shared with dependents + if (true === $this->participant->isApplicant()) { + return; + } + // Skip validation for children (under 16) if (true === $this->participant->isChild()) { return;