fix: refuse implausible accommodation booking prices
This commit is contained in:
1 parent
773cd4f847
commit
56adf72d12
16 files changed
+628
-15
No files matched your search
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class AccommodationBookingDto
|
||||
@@ -16,13 +17,16 @@ class AccommodationBookingDto
|
||||
|
||||
public ?\DateTimeImmutable $dateTo = null;
|
||||
|
||||
#[Assert\Positive(message: 'invalid', groups: ['step_3'])]
|
||||
// step_2 is where the customer types these, so that is the group that has to carry the
|
||||
// bounds: the price is computed from them on the same screen, and an implausible figure
|
||||
// reaching step 4 only surfaces as a failure to store the booking.
|
||||
#[Assert\Range(min: 1, max: AccommodationBooking::MAX_PAX, notInRangeMessage: 'invalid', groups: ['step_2', 'step_3'])]
|
||||
public int $paxCount = 1;
|
||||
|
||||
#[Assert\PositiveOrZero(message: 'invalid', groups: ['step_3'])]
|
||||
#[Assert\Range(min: 0, max: AccommodationBooking::MAX_PAX, notInRangeMessage: 'invalid', groups: ['step_2', 'step_3'])]
|
||||
public int $minorsCount = 0;
|
||||
|
||||
#[Assert\PositiveOrZero(message: 'invalid', groups: ['step_3'])]
|
||||
#[Assert\Range(min: 0, max: AccommodationBooking::MAX_PAX, notInRangeMessage: 'invalid', groups: ['step_2', 'step_3'])]
|
||||
public int $childrenCount = 0;
|
||||
|
||||
#[Assert\NotNull(message: 'required', groups: ['step_2'])]
|
||||
|
||||
Reference in new issue
Block a user