You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -36,14 +39,30 @@ class Range extends Constraint
36
39
public$maxMessage = 'This value should be {{ limit }} or less.';
37
40
public$invalidMessage = 'This value should be a valid number.';
38
41
public$min;
42
+
public$minPropertyPath;
39
43
public$max;
44
+
public$maxPropertyPath;
40
45
41
46
publicfunction__construct($options = null)
42
47
{
48
+
if (\is_array($options)) {
49
+
if (isset($options['min']) && isset($options['minPropertyPath'])) {
50
+
thrownewConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', \get_class($this)));
51
+
}
52
+
53
+
if (isset($options['max']) && isset($options['maxPropertyPath'])) {
54
+
thrownewConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', \get_class($this)));
55
+
}
56
+
<
E864
/td>
57
+
if ((isset($options['minPropertyPath']) || isset($options['maxPropertyPath'])) && !class_exists(PropertyAccess::class)) {
58
+
thrownewLogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', \get_class($this)));
59
+
}
60
+
}
61
+
43
62
parent::__construct($options);
44
63
45
-
if (null === $this->min && null === $this->max) {
46
-
thrownewMissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']);
thrownewMissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint %s', __CLASS__), ['min', 'max']);
0 commit comments