diff --git a/forms.rst b/forms.rst index 83065d7524b..aeeb4fb9385 100644 --- a/forms.rst +++ b/forms.rst @@ -513,7 +513,8 @@ object. - NotBlank: ~ dueDate: - NotBlank: ~ - - Type: \DateTimeInterface + - Type: + type: \DateTimeInterface .. code-block:: xml @@ -530,7 +531,9 @@ object. - \DateTimeInterface + + + diff --git a/reference/constraints/All.rst b/reference/constraints/All.rst index 43ff4d6ac9d..127b005a01c 100644 --- a/reference/constraints/All.rst +++ b/reference/constraints/All.rst @@ -41,9 +41,10 @@ entry in that array: properties: favoriteColors: - All: - - NotBlank: ~ - - Length: - min: 5 + constraints: + - NotBlank: ~ + - Length: + min: 5 .. code-block:: xml diff --git a/reference/constraints/AtLeastOneOf.rst b/reference/constraints/AtLeastOneOf.rst index fecbe617f5a..c4be1657dfc 100644 --- a/reference/constraints/AtLeastOneOf.rst +++ b/reference/constraints/AtLeastOneOf.rst @@ -53,7 +53,8 @@ The following constraints ensure that: properties: password: - AtLeastOneOf: - - Regex: '/#/' + - Regex: + pattern: '/#/' - Length: min: 10 grades: @@ -61,7 +62,9 @@ The following constraints ensure that: - Count: min: 3 - All: - - GreaterThanOrEqual: 5 + constraints: + - GreaterThanOrEqual: + value: 5 .. code-block:: xml @@ -93,7 +96,7 @@ The following constraints ensure that: diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 017b9435cff..197312f1812 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -50,7 +50,8 @@ Configuration # config/validator/validation.yaml App\Entity\Author: constraints: - - Callback: validate + - Callback: + callback: validate .. code-block:: xml @@ -61,7 +62,9 @@ Configuration xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - validate + + + @@ -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 + 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 + 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 + 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 + @@ -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 + + + @@ -242,7 +246,8 @@ current time: App\Entity\Order: properties: deliveryDate: - - GreaterThan: +5 hours + - GreaterThan: + value: +5 hours .. code-block:: xml @@ -254,7 +259,9 @@ current time: - +5 hours + + + diff --git a/reference/constraints/GreaterThanOrEqual.rst b/reference/constraints/GreaterThanOrEqual.rst index 63c2ade6197..39eb81e917b 100644 --- a/reference/constraints/GreaterThanOrEqual.rst +++ b/reference/constraints/GreaterThanOrEqual.rst @@ -45,7 +45,8 @@ The following constraints ensure that: App\Entity\Person: properties: siblings: - - GreaterThanOrEqual: 5 + - GreaterThanOrEqual: + value: 5 age: - GreaterThanOrEqual: value: 18 @@ -61,7 +62,7 @@ The following constraints ensure that: - 5 + @@ -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 + + + @@ -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 + + + @@ -241,7 +248,8 @@ current time: App\Entity\Order: properties: deliveryDate: - - GreaterThanOrEqual: +5 hours + - GreaterThanOrEqual: + value: +5 hours .. code-block:: xml @@ -253,7 +261,9 @@ current time: - +5 hours + + + 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 + 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 + @@ -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 + + + @@ -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 + + + @@ -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 + + + diff --git a/reference/constraints/LessThanOrEqual.rst b/reference/constraints/LessThanOrEqual.rst index ac66c62d7d0..40bdbebc739 100644 --- a/reference/constraints/LessThanOrEqual.rst +++ b/reference/constraints/LessThanOrEqual.rst @@ -45,7 +45,8 @@ The following constraints ensure that: App\Entity\Person: properties: siblings: - - LessThanOrEqual: 5 + - LessThanOrEqual: + value: 5 age: - LessThanOrEqual: value: 80 @@ -61,7 +62,7 @@ The following constraints ensure that: - 5 + @@ -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 + + + @@ -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 + + + @@ -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 + + + 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 + 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 + 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/Traverse.rst b/reference/constraints/Traverse.rst index 56d400fb964..d0e1254884d 100644 --- a/reference/constraints/Traverse.rst +++ b/reference/constraints/Traverse.rst @@ -167,7 +167,8 @@ disable validating: # config/validator/validation.yaml App\Entity\BookCollection: constraints: - - Traverse: false + - Traverse: + traverse: false .. code-block:: xml @@ -178,7 +179,9 @@ disable validating: xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - false + + + 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 + + +