wip: dynamic services fields

This commit is contained in:
Björn Fromme
2026-03-16 11:59:09 +01:00
parent 7003c0d81b
commit 6bd483d768
21 changed files with 634 additions and 39 deletions
@@ -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;
}