fix: correctly validate pickup selection

closes #869c94jqn
This commit is contained in:
Björn Fromme
2026-02-25 16:55:22 +01:00
parent 876cd5a8fa
commit d33ff9779c
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()