wip: field states and dependencies

This commit is contained in:
Björn Fromme committed 2026-03-16 11:59:09 +01:00
1 parent cd7a724e62
commit d0d6844fbd
10 files changed
+1302 -22

No files matched your search

@@ -10,7 +10,8 @@ use App\Form\Model\BookingCreateDto;
* Abstract base class providing common functionality for participant field handlers.
*
* This class implements common patterns used across participant field handlers,
* reducing boilerplate code in concrete implementations.
* including default implementations for field state modification methods.
* Reduces boilerplate code in concrete implementations.
*/
abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandlerInterface
{
@@ -116,4 +117,36 @@ abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandle
return is_numeric($value) ? (int) $value : null;
}
/**
* Returns field state modifications that should be applied after processing.
*
* Default implementation returns no state modifications. Override this method
* in concrete handlers that need to modify field states based on their
* processing results.
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param BookingCreateDto $bookingDto The booking DTO (potentially modified by processing)
* @param int $participantIndex The participant index being processed
*
* @return array<string, array<string, mixed>> Empty array (no state modifications by default)
*/
public function getFieldStateModifications(array $submittedData, BookingCreateDto $bookingDto, int $participantIndex): array
{
return [];
}
/**
* Returns field names whose state is affected by this handler's processing.
*
* Default implementation returns an empty array, meaning this handler doesn't
* affect the state of any fields. Override this method in concrete handlers
* that modify field states.
*
* @return string[] Empty array (no affected fields by default)
*/
public function getAffectedFieldNames(): array
{
return [];
}
}