wip: refactor forms
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\ParticipantFieldHandler;
|
||||
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
|
||||
/**
|
||||
* Interface for handling dynamic participant form field processing.
|
||||
*
|
||||
* Participant field handlers are responsible for processing submitted form data
|
||||
* for booking participants and updating the BookingCreateDto accordingly.
|
||||
* They support dependency management to ensure fields are processed in the correct order.
|
||||
*/
|
||||
interface ParticipantFieldHandlerInterface
|
||||
{
|
||||
/**
|
||||
* Returns the field name this handler processes.
|
||||
*/
|
||||
public function getFieldName(): string;
|
||||
|
||||
/**
|
||||
* Returns field names this handler depends on.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getDependencies(): array;
|
||||
|
||||
/**
|
||||
* Processes the participant field data from submitted form data and updates the DTO.
|
||||
*
|
||||
* @param array<string, mixed> $submittedData The submitted participant form data
|
||||
* @param BookingCreateDto $bookingDto The booking DTO to update
|
||||
* @param int $participantIndex The participant index being processed
|
||||
*/
|
||||
public function processField(array $submittedData, BookingCreateDto $bookingDto, int $participantIndex): void;
|
||||
|
||||
/**
|
||||
* Determines if this handler should process the field based on submitted participant data.
|
||||
*/
|
||||
public function shouldProcess(array $submittedData, int $participantIndex): bool;
|
||||
}
|
||||
Reference in New Issue
Block a user