feat: unify pickup selection
This commit is contained in:
@@ -54,13 +54,16 @@ class ParticipantValidator extends ConstraintValidator
|
||||
|
||||
public function assertPickupSelected(ParticipantDto $participant): void
|
||||
{
|
||||
if (
|
||||
null !== $participant->transportationOutbound
|
||||
&& 'BUS' === $participant->transportationOutbound->subType
|
||||
&& null === $participant->pickupOutbound
|
||||
) {
|
||||
// Check if either outbound or inbound transportation is bus
|
||||
$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) {
|
||||
$this->context->buildViolation('Bitte auswählen')
|
||||
->atPath('pickupOutbound')
|
||||
->atPath('pickup')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user