. */ namespace App\Validator\Constraints\BigDecimal; use Brick\Math\BigDecimal; use Symfony\Component\Validator\Constraints\AbstractComparisonValidator; use Symfony\Component\Validator\Constraints\GreaterThan; /** * Validates values are greater than the previous (>). * * @author Daniel Holmes * @author Bernhard Schussek */ class BigDecimalGreaterThanValidator extends AbstractComparisonValidator { /** * {@inheritdoc} */ protected function compareValues($value1, $value2) { if ($value1 instanceof BigDecimal) { $value1 = (string) $value1; } if ($value2 instanceof BigDecimal) { $value2 = (string) $value2; } return null === $value2 || $value1 > $value2; } /** * {@inheritdoc} */ protected function getErrorCode() { return GreaterThan::TOO_LOW_ERROR; } }