fix: correctly validate pickup selection
closes #869c94jqn
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user