fix: correctly validate pickup selection

closes #869c94jqn
This commit is contained in:
Björn Fromme
2026-03-16 12:03:00 +01:00
parent 51ce9b6e45
commit 474d171779
2 changed files with 54 additions and 5 deletions
@@ -28,14 +28,12 @@ class ParticipantValidator extends ConstraintValidator
public function assertPickupSelected(ParticipantDto $participant): void
{
// Check if either outbound or inbound transportation is bus
// Pickup applies only to outbound bus journey
$hasOutboundBus = null !== $participant->transportationOutbound
&& 'BUS' === $participant->transportationOutbound->subType;
$hasInboundBus = null !== $participant->transportationInbound
&& 'BUS' === $participant->transportationInbound->subType;
// Require pickup if at least one direction has bus transport
if (($hasOutboundBus || $hasInboundBus) && null === $participant->pickup) {
// Require pickup only when outbound transportation is bus
if (true === $hasOutboundBus && null === $participant->pickup) {
$this->context->buildViolation('Bitte auswählen')
->atPath('pickup')
->addViolation()