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

@@ -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
}