| @@ 47-54 (lines=8) @@ | ||
| 44 | list($min, $max) = Currency::getMinMaxs($currency); |
|
| 45 | $divisor = Currency::getDivisionOffset($currency); |
|
| 46 | ||
| 47 | if ($amount < $min) { |
|
| 48 | $this->context->buildViolation($constraint->minMessage) |
|
| 49 | ->atPath($constraint->amountField) |
|
| 50 | ->setParameter('{{ amount }}', number_format($min / $divisor)) |
|
| 51 | ->setParameter('{{ currency }}', $currency) |
|
| 52 | ->addViolation(); |
|
| 53 | return; |
|
| 54 | } |
|
| 55 | ||
| 56 | if ($amount > $max) { |
|
| 57 | $this->context->buildViolation($constraint->maxMessage) |
|
| @@ 56-63 (lines=8) @@ | ||
| 53 | return; |
|
| 54 | } |
|
| 55 | ||
| 56 | if ($amount > $max) { |
|
| 57 | $this->context->buildViolation($constraint->maxMessage) |
|
| 58 | ->atPath($constraint->amountField) |
|
| 59 | ->setParameter('{{ amount }}', number_format($max / $divisor)) |
|
| 60 | ->setParameter('{{ currency }}', $currency) |
|
| 61 | ->addViolation(); |
|
| 62 | return; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||