feat: special treatment of participants with age 0-2 (babies)
This commit is contained in:
@@ -9,8 +9,6 @@ use Symfony\Component\Validator\Constraint;
|
||||
#[\Attribute]
|
||||
class RoomSelection extends Constraint
|
||||
{
|
||||
public const BABY_ROOM_CODE = 'Baby';
|
||||
|
||||
public string $noRoomSelectedMessage = 'Bitte mindestens ein Zimmer/Bett auswählen';
|
||||
public string $onlyBabyRoomsMessage = 'Baby-Zimmer können nur in Kombination mit regulären Zimmern gebucht werden.';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Validator\Constraints;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use App\Form\Model\BookingDto;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
@@ -50,14 +51,14 @@ class RoomSelectionValidator extends ConstraintValidator
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RoomSelection::BABY_ROOM_CODE === $room->code) {
|
||||
if (Constants::BABY_ROOM_CODE === $room->code) {
|
||||
$hasBabyRoom = true;
|
||||
} else {
|
||||
$hasRegularRoom = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasBabyRoom && !$hasRegularRoom) {
|
||||
if ($hasBabyRoom && false === $hasRegularRoom) {
|
||||
$this->context->buildViolation($constraint->onlyBabyRoomsMessage)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user