fix: adapt changes in create mode for edit mode, cleanup
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Entity\User;
|
||||
use App\Form\BookingEditType;
|
||||
use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Form\Service\ParticipantFieldHandlerRegistry;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Security\Crypt;
|
||||
@@ -244,10 +245,15 @@ class IndexController extends AbstractController
|
||||
return $this->redirectToRoute('app_booking_edit', ['id' => $id]);
|
||||
}
|
||||
|
||||
// Create wrapper DTO for email uniqueness validation
|
||||
$wrapper = new ParticipantEditDto(
|
||||
participant: $participant,
|
||||
bookingContext: $bookingDto,
|
||||
);
|
||||
|
||||
// Create form for participant with booking context
|
||||
$form = $this->createForm(BookingParticipantType::class, $participant, [
|
||||
$form = $this->createForm(BookingParticipantType::class, $wrapper, [
|
||||
'booking_context' => $bookingDto,
|
||||
'edit_mode' => true,
|
||||
'validation_groups' => ['booking_edit'],
|
||||
]);
|
||||
|
||||
@@ -327,10 +333,15 @@ class IndexController extends AbstractController
|
||||
? $this->travelDataService->getMutabilityData($bookingData->dateId)
|
||||
: null;
|
||||
|
||||
// Create wrapper DTO for form
|
||||
$wrapper = new ParticipantEditDto(
|
||||
participant: $bookingDto->participants[$index],
|
||||
bookingContext: $bookingDto,
|
||||
);
|
||||
|
||||
// Create form with validation disabled
|
||||
$form = $this->createForm(BookingParticipantType::class, $bookingDto->participants[$index], [
|
||||
$form = $this->createForm(BookingParticipantType::class, $wrapper, [
|
||||
'booking_context' => $bookingDto,
|
||||
'edit_mode' => true,
|
||||
'validation_groups' => false,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user