wip: email uniqueness validation

This commit is contained in:
Björn Fromme
2025-10-23 09:29:27 +02:00
parent 60176d19f4
commit 3e54a58b9b
11 changed files with 549 additions and 783 deletions
@@ -6,6 +6,7 @@ namespace App\Controller\Booking\Traits;
use App\Form\BookingParticipantType;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantEditDto;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -61,12 +62,18 @@ trait ParticipantCardFlowTrait
throw new \InvalidArgumentException(sprintf('Participant at index %d does not exist', $index));
}
// Create wrapper DTO for email uniqueness validation
$wrapper = new ParticipantEditDto(
participant: $participant,
bookingContext: $bookingDto,
);
// Merge default options with provided options
$formOptions = array_merge([
'booking_context' => $bookingDto,
], $options);
return $this->createForm(BookingParticipantType::class, $participant, $formOptions);
return $this->createForm(BookingParticipantType::class, $wrapper, $formOptions);
}
/**