+
@@ -177,7 +180,8 @@ You can then use the following configuration to invoke this validator:
# config/validator/validation.yaml
App\Entity\Author:
constraints:
- - Callback: [Acme\Validator, validate]
+ - Callback:
+ callback: [Acme\Validator, validate]
.. code-block:: xml
@@ -189,8 +193,10 @@ You can then use the following configuration to invoke this validator:
- Acme\Validator
- validate
+
+ Acme\Validator
+ validate
+
diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst
index 084f24cdf76..746d0e44aa7 100644
--- a/reference/constraints/Charset.rst
+++ b/reference/constraints/Charset.rst
@@ -41,7 +41,8 @@ class uses UTF-8, you could do the following:
App\Entity\FileDTO:
properties:
content:
- - Charset: 'UTF-8'
+ - Charset:
+ charset: 'UTF-8'
.. code-block:: xml
diff --git a/reference/constraints/DivisibleBy.rst b/reference/constraints/DivisibleBy.rst
index 23b36023cff..9685f46fe82 100644
--- a/reference/constraints/DivisibleBy.rst
+++ b/reference/constraints/DivisibleBy.rst
@@ -49,7 +49,8 @@ The following constraints ensure that:
App\Entity\Item:
properties:
weight:
- - DivisibleBy: 0.25
+ - DivisibleBy:
+ value: 0.25
quantity:
- DivisibleBy:
value: 5
@@ -65,7 +66,7 @@ The following constraints ensure that:
- 0.25
+
0.25
diff --git a/reference/constraints/EqualTo.rst b/reference/constraints/EqualTo.rst
index fdc402b1a97..d0b9c2b2c75 100644
--- a/reference/constraints/EqualTo.rst
+++ b/reference/constraints/EqualTo.rst
@@ -48,7 +48,8 @@ and that the ``age`` is ``20``, you could do the following:
App\Entity\Person:
properties:
firstName:
- - EqualTo: Mary
+ - EqualTo:
+ value: Mary
age:
- EqualTo:
value: 20
@@ -64,7 +65,7 @@ and that the ``age`` is ``20``, you could do the following:
- Mary
+
Mary
diff --git a/reference/constraints/GreaterThan.rst b/reference/constraints/GreaterThan.rst
index d1b79028acd..c8b72851068 100644
--- a/reference/constraints/GreaterThan.rst
+++ b/reference/constraints/GreaterThan.rst
@@ -46,7 +46,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
siblings:
- - GreaterThan: 5
+ - GreaterThan:
+ value: 5
age:
- GreaterThan:
value: 18
@@ -62,7 +63,7 @@ The following constraints ensure that:
- 5
+
5
@@ -182,7 +183,8 @@ dates. If you want to fix the timezone, append it to the date string:
App\Entity\Order:
properties:
deliveryDate:
- - GreaterThan: today UTC
+ - GreaterThan:
+ value: today UTC
.. code-block:: xml
@@ -194,7 +196,9 @@ dates. If you want to fix the timezone, append it to the date string:
- today UTC
+
+
@@ -122,7 +123,8 @@ that a date must at least be the current day:
App\Entity\Order:
properties:
deliveryDate:
- - GreaterThanOrEqual: today
+ - GreaterThanOrEqual:
+ value: today
.. code-block:: xml
@@ -134,7 +136,9 @@ that a date must at least be the current day:
- today
+
+
today
+
@@ -181,7 +185,8 @@ dates. If you want to fix the timezone, append it to the date string:
App\Entity\Order:
properties:
deliveryDate:
- - GreaterThanOrEqual: today UTC
+ - GreaterThanOrEqual:
+ value: today UTC
.. code-block:: xml
@@ -193,7 +198,9 @@ dates. If you want to fix the timezone, append it to the date string:
- today UTC
+
+
+
diff --git a/reference/constraints/IdenticalTo.rst b/reference/constraints/IdenticalTo.rst
index f8844f90a72..024ad7ad2a1 100644
--- a/reference/constraints/IdenticalTo.rst
+++ b/reference/constraints/IdenticalTo.rst
@@ -51,7 +51,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
firstName:
- - IdenticalTo: Mary
+ - IdenticalTo:
+ value: Mary
age:
- IdenticalTo:
value: 20
@@ -67,7 +68,7 @@ The following constraints ensure that:
- Mary
+
Mary
diff --git a/reference/constraints/LessThan.rst b/reference/constraints/LessThan.rst
index 3d23bcda445..859d7bae83f 100644
--- a/reference/constraints/LessThan.rst
+++ b/reference/constraints/LessThan.rst
@@ -46,7 +46,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
siblings:
- - LessThan: 5
+ - LessThan:
+ value: 5
age:
- LessThan:
value: 80
@@ -62,7 +63,7 @@ The following constraints ensure that:
- 5
+
5
@@ -123,7 +124,8 @@ that a date must be in the past like this:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThan: today
+ - LessThan:
+ value: today
.. code-block:: xml
@@ -135,7 +137,9 @@ that a date must be in the past like this:
- today
+
+
today
+
@@ -182,7 +186,8 @@ dates. If you want to fix the timezone, append it to the date string:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThan: today UTC
+ - LessThan:
+ value: today UTC
.. code-block:: xml
@@ -194,7 +199,9 @@ dates. If you want to fix the timezone, append it to the date string:
- today UTC
+
+
today UTC
+
@@ -241,7 +248,8 @@ can check that a person must be at least 18 years old like this:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThan: -18 years
+ - LessThan:
+ value: -18 years
.. code-block:: xml
@@ -253,7 +261,9 @@ can check that a person must be at least 18 years old like this:
- -18 years
+
+
@@ -122,7 +123,8 @@ that a date must be today or in the past like this:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThanOrEqual: today
+ - LessThanOrEqual:
+ value: today
.. code-block:: xml
@@ -134,7 +136,9 @@ that a date must be today or in the past like this:
- today
+
+
today
+
@@ -181,7 +185,8 @@ dates. If you want to fix the timezone, append it to the date string:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThanOrEqual: today UTC
+ - LessThanOrEqual:
+ value: today UTC
.. code-block:: xml
@@ -193,7 +198,9 @@ dates. If you want to fix the timezone, append it to the date string:
- today UTC
+
+
today UTC
+
@@ -240,7 +247,8 @@ can check that a person must be at least 18 years old like this:
App\Entity\Person:
properties:
dateOfBirth:
- - LessThanOrEqual: -18 years
+ - LessThanOrEqual:
+ value: -18 years
.. code-block:: xml
@@ -252,7 +260,9 @@ can check that a person must be at least 18 years old like this:
- -18 years
+
+
-18 years
+
diff --git a/reference/constraints/Negative.rst b/reference/constraints/Negative.rst
index 0d043ee8f6e..b47806f5291 100644
--- a/reference/constraints/Negative.rst
+++ b/reference/constraints/Negative.rst
@@ -50,7 +50,7 @@ The following constraint ensures that the ``withdraw`` of a bank account
-
+
diff --git a/reference/constraints/NegativeOrZero.rst b/reference/constraints/NegativeOrZero.rst
index 5f221950528..f6d94af84ee 100644
--- a/reference/constraints/NegativeOrZero.rst
+++ b/reference/constraints/NegativeOrZero.rst
@@ -49,7 +49,7 @@ is a negative number or equal to zero:
-
+
diff --git a/reference/constraints/NotCompromisedPassword.rst b/reference/constraints/NotCompromisedPassword.rst
index 6641f9d8cb2..b2ae775b0ce 100644
--- a/reference/constraints/NotCompromisedPassword.rst
+++ b/reference/constraints/NotCompromisedPassword.rst
@@ -49,7 +49,7 @@ The following constraint ensures that the ``rawPassword`` property of the
-
+
diff --git a/reference/constraints/NotEqualTo.rst b/reference/constraints/NotEqualTo.rst
index dd3f633b4a1..ce8ecb7dea5 100644
--- a/reference/constraints/NotEqualTo.rst
+++ b/reference/constraints/NotEqualTo.rst
@@ -50,7 +50,8 @@ the following:
App\Entity\Person:
properties:
firstName:
- - NotEqualTo: Mary
+ - NotEqualTo:
+ value: Mary
age:
- NotEqualTo:
value: 15
@@ -66,7 +67,7 @@ the following:
- Mary
+
Mary
diff --git a/reference/constraints/NotIdenticalTo.rst b/reference/constraints/NotIdenticalTo.rst
index b2c20027292..a45731fa2e3 100644
--- a/reference/constraints/NotIdenticalTo.rst
+++ b/reference/constraints/NotIdenticalTo.rst
@@ -51,7 +51,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
firstName:
- - NotIdenticalTo: Mary
+ - NotIdenticalTo:
+ value: Mary
age:
- NotIdenticalTo:
value: 15
@@ -67,7 +68,7 @@ The following constraints ensure that:
- Mary
+
Mary
diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst
index 0b242cacf08..d1489938236 100644
--- a/reference/constraints/PasswordStrength.rst
+++ b/reference/constraints/PasswordStrength.rst
@@ -53,7 +53,7 @@ By default, the minimum required score is ``2``.
-
+
diff --git a/reference/constraints/Positive.rst b/reference/constraints/Positive.rst
index b43fdde67d8..84c3bc11099 100644
--- a/reference/constraints/Positive.rst
+++ b/reference/constraints/Positive.rst
@@ -50,7 +50,7 @@ positive number (greater than zero):
-
+
diff --git a/reference/constraints/PositiveOrZero.rst b/reference/constraints/PositiveOrZero.rst
index 4aa8420993c..f3c54c85394 100644
--- a/reference/constraints/PositiveOrZero.rst
+++ b/reference/constraints/PositiveOrZero.rst
@@ -49,7 +49,7 @@ is positive or zero:
-
+
diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst
index e3b4d4711b2..1b48eba1dff 100644
--- a/reference/constraints/Regex.rst
+++ b/reference/constraints/Regex.rst
@@ -38,7 +38,8 @@ more word characters at the beginning of your string:
App\Entity\Author:
properties:
description:
- - Regex: '/^\w+/'
+ - Regex:
+ pattern: '/^\w+/'
.. code-block:: xml
diff --git a/reference/constraints/Sequentially.rst b/reference/constraints/Sequentially.rst
index 078be338cdf..f2ec1cb0cb6 100644
--- a/reference/constraints/Sequentially.rst
+++ b/reference/constraints/Sequentially.rst
@@ -64,9 +64,11 @@ You can validate each of these constraints sequentially to solve these issues:
address:
- Sequentially:
- NotNull: ~
- - Type: string
+ - Type:
+ value: string
- Length: { min: 10 }
- - Regex: !php/const App\Localization\Place::ADDRESS_REGEX
+ - Regex:
+ pattern: !php/const App\Localization\Place::ADDRESS_REGEX
- App\Validator\Constraints\Geolocalizable: ~
.. code-block:: xml
@@ -81,7 +83,9 @@ You can validate each of these constraints sequentially to solve these issues:
- string
+
+
+
diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst
index b49536dff8b..7d2b4ffaa89 100644
--- a/reference/constraints/Type.rst
+++ b/reference/constraints/Type.rst
@@ -58,10 +58,12 @@ The following example checks if ``emailAddress`` is an instance of ``Symfony\Com
App\Entity\Author:
properties:
emailAddress:
- - Type: Symfony\Component\Mime\Address
+ - Type:
+ type: Symfony\Component\Mime\Address
firstName:
- - Type: string
+ - Type:
+ type: string
age:
- Type:
diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst
index 219ce4ed4ef..1ba0bcd27f6 100644
--- a/reference/constraints/UniqueEntity.rst
+++ b/reference/constraints/UniqueEntity.rst
@@ -56,7 +56,8 @@ between all of the rows in your user table:
# config/validator/validation.yaml
App\Entity\User:
constraints:
- - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: email
+ - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
+ fields: email
properties:
email:
- Email: ~
diff --git a/reference/constraints/When.rst b/reference/constraints/When.rst
index 4b2e8eb7590..1c1292b8f17 100644
--- a/reference/constraints/When.rst
+++ b/reference/constraints/When.rst
@@ -85,7 +85,8 @@ One way to accomplish this is with the When constraint:
App\Model\Discount:
properties:
value:
- - GreaterThan: 0
+ - GreaterThan:
+ value: 0
- When:
expression: "this.getType() == 'percent'"
constraints:
@@ -106,7 +107,9 @@ One way to accomplish this is with the When constraint:
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
- 0
+
+