wip: form refactoring

This commit is contained in:
Björn Fromme
2026-03-16 11:59:09 +01:00
parent 65a33922cf
commit d719b17aec
13 changed files with 158 additions and 100 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service;
use App\Form\Model\BookingCreateDto;
use App\Form\Model\BookingDtoInterface;
use App\Form\ParticipantFieldHandler\Condition\FieldConditionInterface;
@@ -26,6 +27,8 @@ use App\Form\ParticipantFieldHandler\Condition\FieldConditionInterface;
*/
class ParticipantFieldOptionsProvider implements FieldStateProviderInterface
{
use FormTraversalTrait;
/** @var array<string, callable> Field option providers indexed by field name */
private array $fieldOptionProviders = [];
@@ -120,7 +123,7 @@ class ParticipantFieldOptionsProvider implements FieldStateProviderInterface
*/
private function registerFieldOptionProviders(): void
{
// Room assignment field provider
// Room assignment field provider (only available for create workflow)
$this->fieldOptionProviders['assignedRoomId'] = fn (BookingDtoInterface $bookingDto, int $participantIndex) => [
'label' => 'Zimmer',
'placeholder' => 'Bitte wählen',
@@ -128,11 +131,13 @@ class ParticipantFieldOptionsProvider implements FieldStateProviderInterface
// - Shows only available rooms for this participant
// - Excludes rooms already assigned to other participants
// - Respects room capacity and booking constraints
'choice_loader' => $this->roomChoiceLoaderFactory->create(
$bookingDto->participants,
$bookingDto->getSelectedRooms(),
$participantIndex
),
'choice_loader' => $bookingDto instanceof BookingCreateDto
? $this->roomChoiceLoaderFactory->create(
$bookingDto->participants,
$bookingDto->getSelectedRooms(),
$participantIndex
)
: null,
];
// Future field providers would be added here, for example: