wip: modernized edit flow

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 0d073a36a3
commit 28831a3b06
75 changed files with 1662 additions and 747 deletions
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Contract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
/**
* Interface for evaluating field state conditions.
@@ -29,13 +29,13 @@ interface FieldConditionInterface
* state of the booking, participant data, and submitted form values.
* The result is used to determine field state (enabled/disabled/readonly).
*
* @param BookingDtoInterface $bookingDto The current booking data (create or edit)
* @param BookingDto $bookingDto The current booking data (create or edit)
* @param int $participantIndex The index of the participant being evaluated
* @param array<string, mixed> $formData Current form data (may include partial submissions)
*
* @return bool True if the condition is met, false otherwise
*/
public function evaluate(BookingDtoInterface $bookingDto, int $participantIndex, array $formData): bool;
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool;
/**
* Returns field names that trigger re-evaluation of this condition.
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Contract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
/**
* Interface for providing dynamic field options based on context.
@@ -42,13 +42,13 @@ interface FieldOptionsProviderInterface
* static options defined in the form type.
*
* @param string $fieldName The name of the field to configure
* @param BookingDtoInterface $bookingDto The current booking data for context (create or edit)
* @param BookingDto $bookingDto The current booking data for context (create or edit)
* @param int $participantIndex The index of the participant being configured
* @param array $options Additional options to customize field behavior
*
* @return array<string, mixed> Symfony form field options, or empty array if field not supported
*/
public function getFieldOptions(string $fieldName, BookingDtoInterface $bookingDto, int $participantIndex, array $options = []): array;
public function getFieldOptions(string $fieldName, BookingDto $bookingDto, int $participantIndex, array $options = []): array;
/**
* Checks whether a field has option provider support.
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Contract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
/**
* Interface for providing dynamic field state based on conditions.
@@ -38,13 +38,13 @@ interface FieldStateProviderInterface
* condition independently to allow early field exclusion during form building.
*
* @param string $fieldName The name of the field to evaluate
* @param BookingDtoInterface $bookingDto The current booking data for context (create or edit)
* @param BookingDto $bookingDto The current booking data for context (create or edit)
* @param int $participantIndex The index of the participant being evaluated
* @param array<string, mixed> $formData Current form data for condition evaluation
*
* @return bool True if the field should be included in the form, false if it should be excluded
*/
public function shouldIncludeField(string $fieldName, BookingDtoInterface $bookingDto, int $participantIndex, array $formData = []): bool;
public function shouldIncludeField(string $fieldName, BookingDto $bookingDto, int $participantIndex, array $formData = []): bool;
/**
* Calculates the dynamic state for a specified field.
@@ -65,13 +65,13 @@ interface FieldStateProviderInterface
* - 'attr' => ['class' => 'conditional-field'] - Add CSS classes
*
* @param string $fieldName The name of the field to evaluate
* @param BookingDtoInterface $bookingDto The current booking data for context (create or edit)
* @param BookingDto $bookingDto The current booking data for context (create or edit)
* @param int $participantIndex The index of the participant being evaluated
* @param array<string, mixed> $formData Current form data (may include partial submissions)
*
* @return array<string, mixed> Symfony form field options for state modifications, empty if no changes needed
*/
public function getFieldState(string $fieldName, BookingDtoInterface $bookingDto, int $participantIndex, array $formData = []): array;
public function getFieldState(string $fieldName, BookingDto $bookingDto, int $participantIndex, array $formData = []): array;
/**
* Checks whether a field has state conditions configured.
@@ -110,11 +110,11 @@ interface FieldStateProviderInterface
* when multiple field states need to be determined simultaneously. It's
* particularly useful during form building and bulk state updates.
*
* @param BookingDtoInterface $bookingDto The current booking data for context (create or edit)
* @param BookingDto $bookingDto The current booking data for context (create or edit)
* @param int $participantIndex The index of the participant being evaluated
* @param array<string, mixed> $formData Current form data for condition evaluation
*
* @return array<string, array<string, mixed>> Field states indexed by field name
*/
public function getAllFieldStates(BookingDtoInterface $bookingDto, int $participantIndex, array $formData = []): array;
public function getAllFieldStates(BookingDto $bookingDto, int $participantIndex, array $formData = []): array;
}
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Contract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
/**
* Interface for handling dynamic participant form field processing and state modification.
@@ -32,10 +32,10 @@ interface ParticipantFieldHandlerInterface
* Processes the participant field data from submitted form data and updates the DTO.
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param BookingDtoInterface $bookingDto The booking DTO to update (create or edit)
* @param BookingDto $bookingDto The booking DTO to update (create or edit)
* @param int $participantIndex The participant index being processed
*/
public function processField(array $submittedData, BookingDtoInterface $bookingDto, int $participantIndex): void;
public function processField(array $submittedData, BookingDto $bookingDto, int $participantIndex): void;
/**
* Determines if this handler should process the field based on submitted participant data.
@@ -50,12 +50,12 @@ interface ParticipantFieldHandlerInterface
* to enable/disable/hide fields based on the handler's processing results.
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param BookingDtoInterface $bookingDto The booking DTO (potentially modified by processing)
* @param BookingDto $bookingDto The booking DTO (potentially modified by processing)
* @param int $participantIndex The participant index being processed
*
* @return array<string, array<string, mixed>> Field state modifications indexed by field name
*/
public function getFieldStateModifications(array $submittedData, BookingDtoInterface $bookingDto, int $participantIndex): array;
public function getFieldStateModifications(array $submittedData, BookingDto $bookingDto, int $participantIndex): array;
/**
* Returns field names whose state is affected by this handler's processing.