feat: centralize create/edit flow contexts, extract edit submit service

This commit is contained in:
Björn Fromme committed 2026-04-12 10:17:04 +02:00
1 parent f903f17ebd
commit 69705052b3
28 files changed
+1342 -423

No files matched your search

@@ -7,12 +7,13 @@ namespace App\Controller\Booking\Create;
use App\Form\BookingParticipantType;
use App\Form\Model\BookingDto;
use App\Htmx\HxTrait;
use App\Service\BookingCreateContextFactory;
use App\Service\BookingService;
use App\Service\BookingSessionService;
use App\Service\BookingSummaryDataService;
use App\Service\ParticipantFormSupportService;
use App\Service\ParticipantPrepopulationService;
use App\Service\TravelDataService;
use App\Service\RoomPricingCalculator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -29,7 +30,7 @@ class Step2ParticipantController extends AbstractController
public function __construct(
private readonly BookingService $bookingService,
private readonly BookingSessionService $bookingSessionService,
private readonly BookingSummaryDataService $summaryDataService,
private readonly BookingCreateContextFactory $createContextFactory,
private readonly TravelDataService $travelDataService,
private readonly ParticipantPrepopulationService $prepopulationService,
private readonly ParticipantFormSupportService $participantFormSupportService,
@@ -128,11 +129,15 @@ class Step2ParticipantController extends AbstractController
int $index,
BookingDto $bookingDto,
): Response {
$bookingCreateContext = $this->createContextFactory->create(
$bookingDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
return $this->render('booking/create/step_2_participant.html.twig', [
'form' => $form->createView(),
'participantIndex' => $index,
'bookingDto' => $bookingDto,
'summaryData' => $this->summaryDataService->getSummaryData($bookingDto),
'bookingCreateContext' => $bookingCreateContext,
'refreshRouteName' => 'app_booking_create_step_2_participant_refresh',
]);
}
@@ -190,7 +195,10 @@ class Step2ParticipantController extends AbstractController
$this->bookingSessionService->saveBookingDto($request, $bookingDto, $bookingDto->getMode());
$summaryData = $this->summaryDataService->getSummaryData($bookingDto);
$bookingCreateContext = $this->createContextFactory->create(
$bookingDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
$response = $this->htmxOobResponse(
'booking/_participant_form.html.twig',
@@ -198,8 +206,7 @@ class Step2ParticipantController extends AbstractController
[
'form' => $form->createView(),
'participantIndex' => $index,
'bookingDto' => $bookingDto,
'summaryData' => $summaryData,
'bookingCreateContext' => $bookingCreateContext,
'refreshRouteName' => $refreshRouteName,
]
);