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
@@ -50,6 +50,24 @@ class ParticipantAdditionalServicesFieldHandler extends AbstractParticipantField
return ['dateOfBirth'];
}
/**
* Determines if this handler should process the field based on submitted data.
*
* For service selection fields like additional services, 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
}
/**
* Processes the additionalServices field for a specific participant.
*
@@ -154,7 +172,7 @@ class ParticipantAdditionalServicesFieldHandler extends AbstractParticipantField
// Check if service has age constraints
$ageEvaluator = new ServiceAgeEvaluator();
if (!$ageEvaluator->canEvaluate($service)) {
if (false === $ageEvaluator->canEvaluate($service)) {
return true; // No age restrictions, service is valid
}