wip: email uniqueness validation
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Controller\Booking\Traits;
|
||||
|
||||
use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -61,12 +62,18 @@ trait ParticipantCardFlowTrait
|
||||
throw new \InvalidArgumentException(sprintf('Participant at index %d does not exist', $index));
|
||||
}
|
||||
|
||||
// Create wrapper DTO for email uniqueness validation
|
||||
$wrapper = new ParticipantEditDto(
|
||||
participant: $participant,
|
||||
bookingContext: $bookingDto,
|
||||
);
|
||||
|
||||
// Merge default options with provided options
|
||||
$formOptions = array_merge([
|
||||
'booking_context' => $bookingDto,
|
||||
], $options);
|
||||
|
||||
return $this->createForm(BookingParticipantType::class, $participant, $formOptions);
|
||||
return $this->createForm(BookingParticipantType::class, $wrapper, $formOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user