Skip to content

Commit 0ca9832

Browse files
author
Florent Mata
committed
Update Expression constraint with "negate" option
1 parent cf50198 commit 0ca9832

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reference/constraints/Expression.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ expression that must return true in order for validation to pass. To learn
143143
more about the expression language syntax, see
144144
:doc:`/components/expression_language/syntax`.
145145

146+
.. versionadded:: 6.2
147+
148+
The `negate` option was introduced in Symfony 6.2.
149+
150+
Alternatively, you can set the `negate` option to ``false`` in order to
151+
assert that the expression must return ``true`` for validation to fail.
152+
146153
.. sidebar:: Mapping the Error to a Specific Field
147154

148155
You can also attach the constraint to a specific property and still validate
@@ -294,6 +301,17 @@ Parameter Description
294301
``{{ label }}`` Corresponding form field label
295302
=============== ==============================================================
296303

304+
``negate``
305+
~~~~~~~~~~~
306+
307+
**type**: ``boolean`` **default**: ``true``
308+
309+
If ``false``, the validation fails when expression returns ``true``.
310+
311+
.. versionadded:: 6.2
312+
313+
The `negate` option was introduced in Symfony 6.2.
314+
297315
.. include:: /reference/constraints/_payload-option.rst.inc
298316

299317
``values``

0 commit comments

Comments
 (0)