feat: improved dynamic validation
This commit is contained in:
@@ -81,9 +81,7 @@ class Step2Controller extends AbstractController
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Create validation form
|
||||
$form = $this->createForm(BookingCreateStep2Type::class, $bookingCreateDto, [
|
||||
'validation_groups' => ['booking_create'],
|
||||
]);
|
||||
$form = $this->createForm(BookingCreateStep2Type::class, $bookingCreateDto);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// Handle form submission
|
||||
@@ -98,7 +96,7 @@ class Step2Controller extends AbstractController
|
||||
|
||||
// Generate cards data with validation state if form was submitted and failed
|
||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto, ['booking_create'])
|
||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto)
|
||||
: $this->generateAllCardsData($bookingCreateDto);
|
||||
|
||||
// Calculate summary data
|
||||
@@ -150,9 +148,7 @@ class Step2Controller extends AbstractController
|
||||
$this->enrichWithFreshAvailabilities($bookingDto);
|
||||
|
||||
// Create form with booking_context option
|
||||
$form = $this->createParticipantForm($bookingDto, $index, [
|
||||
'validation_groups' => ['booking_create'],
|
||||
]);
|
||||
$form = $this->createParticipantForm($bookingDto, $index);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user