wip: dynamic services fields

This commit is contained in:
Björn Fromme committed 2025-08-27 17:49:49 +02:00
1 parent 369d660e24
commit 60b655a195
21 files changed
+634 -39

No files matched your search

@@ -31,6 +31,24 @@ class ParticipantBoardFieldHandler extends AbstractParticipantFieldHandler
return ['dateOfBirth'];
}
/**
* Determines if this handler should process the field based on submitted data.
*
* For service selection fields like board options, we always need to process
* to handle cases where all selections are cleared (field not present in data).
* This ensures the participant DTO is updated with an empty array when no
* services are selected.
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param int $participantIndex The index of the participant being processed
*
* @return bool Always returns true for service selection fields
*/
public function shouldProcess(array $submittedData, int $participantIndex): bool
{
return true; // Always process to handle deselection cases
}
public function processField(array $submittedData, BookingDtoInterface $bookingDto, int $participantIndex): void
{
$participant = $this->getParticipant($bookingDto, $participantIndex);
@@ -81,7 +99,7 @@ class ParticipantBoardFieldHandler extends AbstractParticipantFieldHandler
}
$ageEvaluator = new ServiceAgeEvaluator();
if (!$ageEvaluator->canEvaluate($service)) {
if (false === $ageEvaluator->canEvaluate($service)) {
return true;
}