@@ -10,11 +10,10 @@ expression.
10
10
11
11
========== ===================================================================
12
12
Applies to:ref: `property or method <validation-property-target >`
13
- Options - `groups `_
13
+ Options - `allowedVariables `_
14
+ - `groups `_
14
15
- `message `_
15
- - `names `_
16
16
- `payload `_
17
- - `validateNames `_
18
17
Class:class: `Symfony\\ Component\\ Validator\\ Constraints\\ ExpressionLanguageSyntax `
19
18
Validator:class: `Symfony\\ Component\\ Validator\\ Constraints\\ ExpressionLanguageSyntaxValidator `
20
19
========== ===================================================================
@@ -47,8 +46,7 @@ The following constraints ensure that:
47
46
48
47
/**
49
48
* @Assert\ExpressionLanguageSyntax(
50
- * names = ['user', 'shipping_centers'],
51
- * validateNames = true
49
+ * allowedVariables = ['user', 'shipping_centers']
52
50
* )
53
51
*/
54
52
protected $shippingOptions;
@@ -63,8 +61,7 @@ The following constraints ensure that:
63
61
-ExpressionLanguageSyntax :~
64
62
shippingOptions :
65
63
-ExpressionLanguageSyntax :
66
- names :['user', 'shipping_centers']
67
- validateNames :true
64
+ allowedVariables :['user', 'shipping_centers']
68
65
69
66
..code-block ::xml
70
67
@@ -80,8 +77,7 @@ The following constraints ensure that:
80
77
</property >
81
78
<property name =" shippingOptions" >
82
79
<constraint name =" ExpressionLanguageSyntax" >
83
- <option name =" names" >['user', 'shipping_centers']</option >
84
- <option name =" validateNames" >true</option >
80
+ <option name =" allowedVariables" >['user', 'shipping_centers']</option >
85
81
</constraint >
86
82
</property >
87
83
</class >
@@ -102,15 +98,23 @@ The following constraints ensure that:
102
98
$metadata->addPropertyConstraint('promotion', new Assert\ExpressionLanguageSyntax());
103
99
104
100
$metadata->addPropertyConstraint('shippingOptions', new Assert\ExpressionLanguageSyntax([
105
- 'names' => ['user', 'shipping_centers'],
106
- 'validateNames' => true,
101
+ 'allowedVariables' => ['user', 'shipping_centers'],
107
102
]));
108
103
}
109
104
}
110
105
111
106
Options
112
107
-------
113
108
109
+ allowedVariables
110
+ ~~~~~~~~~~~~~~~~
111
+
112
+ **type **: ``array `` or ``null `` **default **: ``null ``
113
+
114
+ If this option is defined, the expression can only use the variables whose names
115
+ are included in this option. Unset this option or set its value to ``null `` to
116
+ allow any variables.
117
+
114
118
..include ::/reference/constraints/_groups-option.rst.inc
115
119
116
120
message
@@ -120,23 +124,6 @@ message
120
124
121
125
This is the message displayed when the validation fails.
122
126
123
- names
124
- ~~~~~
125
-
126
- **type **: ``array `` or ``null `` **default **: ``null ``
127
-
128
- If the ``validateNames `` is ``true ``, the expression can only use the variables
129
- whose names are included in this array. Use ``null `` to allow expressions to use
130
- any variables.
131
-
132
127
..include ::/reference/constraints/_payload-option.rst.inc
133
128
134
- validateNames
135
- ~~~~~~~~~~~~~
136
-
137
- **type **: ``bool `` **default **: ``false ``
138
-
139
- Set this option to ``true `` to require the expression to use only the variable
140
- names defined in the ``names `` option.
141
-
142
129
.. _`ExpressionLanguage` :https://symfony.com/components/ExpressionLanguage