From 0ca983234ae5e675cad5c07ff3979753c6158a9b Mon Sep 17 00:00:00 2001 From: Florent Mata Date: Mon, 6 Jun 2022 17:31:39 +0200 Subject: [PATCH] Update Expression constraint with "negate" option --- reference/constraints/Expression.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index 1df2fe73653..e9fec8bfa8e 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -143,6 +143,13 @@ expression that must return true in order for validation to pass. To learn more about the expression language syntax, see :doc:`/components/expression_language/syntax`. +.. versionadded:: 6.2 + + The `negate` option was introduced in Symfony 6.2. + +Alternatively, you can set the `negate` option to ``false`` in order to +assert that the expression must return ``true`` for validation to fail. + .. sidebar:: Mapping the Error to a Specific Field You can also attach the constraint to a specific property and still validate @@ -294,6 +301,17 @@ Parameter Description ``{{ label }}`` Corresponding form field label =============== ============================================================== +``negate`` +~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``true`` + +If ``false``, the validation fails when expression returns ``true``. + +.. versionadded:: 6.2 + + The `negate` option was introduced in Symfony 6.2. + .. include:: /reference/constraints/_payload-option.rst.inc ``values``