Files
myep/src/Form/ParticipantFieldHandler/ParticipantFieldHandlerInterface.php
T
2026-03-16 11:59:09 +01:00

43 lines
1.4 KiB
PHP

<?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;
}