Skip to content

Commit af739ee

Browse files
committed
Updated for the latest code changes
1 parent 338213f commit af739ee

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

reference/constraints/ExpressionLanguageSyntax.rst

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ expression.
1010

1111
========== ===================================================================
1212
Applies to :ref:`property or method <validation-property-target>`
13-
Options - `groups`_
13+
Options - `allowedVariables`_
14+
- `groups`_
1415
- `message`_
15-
- `names`_
1616
- `payload`_
17-
- `validateNames`_
1817
Class :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntax`
1918
Validator :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntaxValidator`
2019
========== ===================================================================
@@ -47,8 +46,7 @@ The following constraints ensure that:
4746
4847
/**
4948
* @Assert\ExpressionLanguageSyntax(
50-
* names = ['user', 'shipping_centers'],
51-
* validateNames = true
49+
* allowedVariables = ['user', 'shipping_centers']
5250
* )
5351
*/
5452
protected $shippingOptions;
@@ -63,8 +61,7 @@ The following constraints ensure that:
6361
- ExpressionLanguageSyntax: ~
6462
shippingOptions:
6563
- ExpressionLanguageSyntax:
66-
names: ['user', 'shipping_centers']
67-
validateNames: true
64+
allowedVariables: ['user', 'shipping_centers']
6865
6966
.. code-block:: xml
7067
@@ -80,8 +77,7 @@ The following constraints ensure that:
8077
</property>
8178
<property name="shippingOptions">
8279
<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>
8581
</constraint>
8682
</property>
8783
</class>
@@ -102,15 +98,23 @@ The following constraints ensure that:
10298
$metadata->addPropertyConstraint('promotion', new Assert\ExpressionLanguageSyntax());
10399
104100
$metadata->addPropertyConstraint('shippingOptions', new Assert\ExpressionLanguageSyntax([
105-
'names' => ['user', 'shipping_centers'],
106-
'validateNames' => true,
101+
'allowedVariables' => ['user', 'shipping_centers'],
107102
]));
108103
}
109104
}
110105
111106
Options
112107
-------
113108

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+
114118
.. include:: /reference/constraints/_groups-option.rst.inc
115119

116120
message
@@ -120,23 +124,6 @@ message
120124

121125
This is the message displayed when the validation fails.
122126

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-
132127
.. include:: /reference/constraints/_payload-option.rst.inc
133128

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-
142129
.. _`ExpressionLanguage`: https://symfony.com/components/ExpressionLanguage

0 commit comments

Comments
 (0)