wip: modernized edit flow

This commit is contained in:
Björn Fromme committed 2026-03-16 11:59:10 +01:00
1 parent 0d073a36a3
commit 28831a3b06
75 files changed
+1662 -747

No files matched your search

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Abstract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
use App\Form\Service\Contract\FieldOptionsProviderInterface;
/**
@@ -37,13 +37,13 @@ abstract class AbstractFieldOptionsProvider implements FieldOptionsProviderInter
* 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
{
// Check if we have a provider for this field
if (false === isset($this->fieldOptionProviders[$fieldName])) {
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Abstract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
use App\Form\Service\Contract\FieldConditionInterface;
use App\Form\Service\Contract\FieldStateProviderInterface;
use App\Form\Service\Trait\FormTraversalTrait;
@@ -36,13 +36,13 @@ abstract class AbstractFieldStateProvider implements FieldStateProviderInterface
* condition independently to allow early field exclusion.
*
* @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
{
if (false === isset($this->fieldStateConditions[$fieldName]['hidden'])) {
return true; // No hidden condition means field should be included
@@ -64,13 +64,13 @@ abstract class AbstractFieldStateProvider implements FieldStateProviderInterface
* excluded from the form entirely rather than hidden with CSS.
*
* @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 array<string, mixed> Symfony form field options for state modifications
*/
public function getFieldState(string $fieldName, BookingDtoInterface $bookingDto, int $participantIndex, array $formData = []): array
public function getFieldState(string $fieldName, BookingDto $bookingDto, int $participantIndex, array $formData = []): array
{
if (false === isset($this->fieldStateConditions[$fieldName])) {
return [];
@@ -139,13 +139,13 @@ abstract class AbstractFieldStateProvider implements FieldStateProviderInterface
/**
* Calculates field states for all configured fields at once.
*
* @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
{
$allStates = [];
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Form\Service\Abstract;
use App\Form\Model\BookingDtoInterface;
use App\Form\Model\BookingDto;
use App\Form\Service\Contract\ParticipantFieldHandlerInterface;
/**
@@ -55,12 +55,12 @@ abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandle
* if the participant exists at the given index. Returns null if the
* participant doesn't exist, preventing array access errors.
*
* @param BookingDtoInterface $bookingDto The booking DTO containing participants (create or edit)
* @param BookingDto $bookingDto The booking DTO containing participants (create or edit)
* @param int $participantIndex The index of the participant to retrieve
*
* @return object|null The participant object, or null if not found
*/
protected function getParticipant(BookingDtoInterface $bookingDto, int $participantIndex): ?object
protected function getParticipant(BookingDto $bookingDto, int $participantIndex): ?object
{
$participants = $bookingDto->getParticipants();
@@ -129,12 +129,12 @@ abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandle
* 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>> Empty array (no state modifications by default)
*/
public function getFieldStateModifications(array $submittedData, BookingDtoInterface $bookingDto, int $participantIndex): array
public function getFieldStateModifications(array $submittedData, BookingDto $bookingDto, int $participantIndex): array
{
return [];
}