feat: body dimensions mandatory with selected rentals, updated help text

feat: body dimensions mandatory with selected rentals
This commit is contained in:
Björn Fromme
2026-01-19 16:12:53 +01:00
parent 2776429639
commit f0c43a17d8
4 changed files with 100 additions and 10 deletions
@@ -22,6 +22,7 @@ class ParticipantValidator extends ConstraintValidator
$participant = $value;
$this->assertPickupSelected($participant);
$this->assertBodyDimensionsWhenRentalsSelected($participant);
}
public function assertPickupSelected(ParticipantDto $participant): void
@@ -40,4 +41,34 @@ class ParticipantValidator extends ConstraintValidator
;
}
}
public function assertBodyDimensionsWhenRentalsSelected(ParticipantDto $participant): void
{
// Check if any rental services are selected
if (true === empty($participant->rentals)) {
return;
}
// Require body dimensions when rentals are selected
if (null === $participant->height || '' === $participant->height) {
$this->context->buildViolation('Bitte auswählen')
->atPath('height')
->addViolation()
;
}
if (null === $participant->weight || '' === $participant->weight) {
$this->context->buildViolation('Bitte auswählen')
->atPath('weight')
->addViolation()
;
}
if (null === $participant->shoeSize || '' === $participant->shoeSize) {
$this->context->buildViolation('Bitte auswählen')
->atPath('shoeSize')
->addViolation()
;
}
}
}