fix: validate body dimensions when rentals are selected only

This commit is contained in:
Björn Fromme
2026-06-02 14:22:47 +02:00
parent f023bd9772
commit 00889318ee
2 changed files with 37 additions and 2 deletions
@@ -38,8 +38,10 @@ class ParticipantValidator extends ConstraintValidator
$this->assertPickupSelected($participant);
$this->assertDropOffSelected($participant);
$this->assertBodyDimensionsWhenRentalsSelected($participant);
$this->assertBodyDimensionsInRange($participant);
if (true === $this->hasRentalsSelected($participant)) {
$this->assertBodyDimensionsWhenRentalsSelected($participant);
$this->assertBodyDimensionsInRange($participant);
}
}
public function assertPickupSelected(ParticipantDto $participant): void
@@ -149,6 +151,11 @@ class ParticipantValidator extends ConstraintValidator
}
}
private function hasRentalsSelected(ParticipantDto $participant): bool
{
return false === empty($participant->rentals);
}
/**
* @param array<string, int> $options
*