From 5b55d0984a6183518bfa2087c14917d22bdfcc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 27 Nov 2025 15:23:35 +0100 Subject: [PATCH] fix: correctly handle email uniqueness by excluding the applicant from validation --- src/Form/Model/ParticipantEditDto.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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;