Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ object.
- NotBlank: ~
dueDate:
- NotBlank: ~
- Type: \DateTimeInterface
- Type:
type: \DateTimeInterface

.. code-block:: xml

Expand All @@ -530,7 +531,9 @@ object.
</property>
<property name="dueDate">
<constraint name="NotBlank"/>
<constraint name="Type">\DateTimeInterface</constraint>
<constraint name="Type">
<option name="type">\DateTimeInterface</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down
7 changes: 4 additions & 3 deletions reference/constraints/All.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ entry in that array:
properties:
favoriteColors:
- All:
- NotBlank: ~
- Length:
min: 5
constraints:
- NotBlank: ~
- Length:
min: 5

.. code-block:: xml

Expand Down
9 changes: 6 additions & 3 deletions reference/constraints/AtLeastOneOf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ The following constraints ensure that:
properties:
password:
- AtLeastOneOf:
- Regex: '/#/'
- Regex:
pattern: '/#/'
- Length:
min: 10
grades:
- AtLeastOneOf:
- Count:
min: 3
- All:
- GreaterThanOrEqual: 5
constraints:
- GreaterThanOrEqual:
value: 5

.. code-block:: xml

Expand Down Expand Up @@ -93,7 +96,7 @@ The following constraints ensure that:
<constraint name="All">
<option name="constraints">
<constraint name="GreaterThanOrEqual">
5
<option name="value">5</option>
</constraint>
</option>
</constraint>
Expand Down
16 changes: 11 additions & 5 deletions reference/constraints/Callback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Configuration
# config/validator/validation.yaml
App\Entity\Author:
constraints:
- Callback: validate
- Callback:
callback: validate

.. code-block:: xml

Expand All @@ -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">

<class name="App\Entity\Author">
<constraint name="Callback">validate</constraint>
<constraint name="Callback">
<option name="callback">validate</option>
</constraint>
</class>
</constraint-mapping>

Expand Down Expand Up @@ -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

Expand All @@ -189,8 +193,10 @@ You can then use the following configuration to invoke this validator:

<class name="App\Entity\Author">
<constraint name="Callback">
<value>Acme\Validator</value>
<value>validate</value>
<option name="callback">
<value>Acme\Validator</value>
<value>validate</value>
</option>
</constraint>
</class>
</constraint-mapping>
Expand Down
3 changes: 2 additions & 1 deletion reference/constraints/Charset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions reference/constraints/DivisibleBy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -65,7 +66,7 @@ The following constraints ensure that:
<class name="App\Entity\Item">
<property name="weight">
<constraint name="DivisibleBy">
<value>0.25</value>
<option name="value">0.25</option>
</constraint>
</property>
<property name="quantity">
Expand Down
5 changes: 3 additions & 2 deletions reference/constraints/EqualTo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,7 +65,7 @@ and that the ``age`` is ``20``, you could do the following:
<class name="App\Entity\Person">
<property name="firstName">
<constraint name="EqualTo">
Mary
<option name="value">Mary</option>
</constraint>
</property>
<property name="age">
Expand Down
19 changes: 13 additions & 6 deletions reference/constraints/GreaterThan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
siblings:
- GreaterThan: 5
- GreaterThan:
value: 5
age:
- GreaterThan:
value: 18
Expand All @@ -62,7 +63,7 @@ The following constraints ensure that:
<class name="App\Entity\Person">
<property name="siblings">
<constraint name="GreaterThan">
5
<option name="value">5</option>
</constraint>
</property>
<property name="age">
Expand Down Expand Up @@ -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

Expand All @@ -194,7 +196,9 @@ dates. If you want to fix the timezone, append it to the date string:

<class name="App\Entity\Order">
<property name="deliveryDate">
<constraint name="GreaterThan">today UTC</constraint>
<constraint name="GreaterThan">
<option name="value">today UTC</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down Expand Up @@ -242,7 +246,8 @@ current time:
App\Entity\Order:
properties:
deliveryDate:
- GreaterThan: +5 hours
- GreaterThan:
value: +5 hours

.. code-block:: xml

Expand All @@ -254,7 +259,9 @@ current time:

<class name="App\Entity\Order">
<property name="deliveryDate">
<constraint name="GreaterThan">+5 hours</constraint>
<constraint name="GreaterThan">
<option name="value">+5 hours</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down
26 changes: 18 additions & 8 deletions reference/constraints/GreaterThanOrEqual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
siblings:
- GreaterThanOrEqual: 5
- GreaterThanOrEqual:
value: 5
age:
- GreaterThanOrEqual:
value: 18
Expand All @@ -61,7 +62,7 @@ The following constraints ensure that:
<class name="App\Entity\Person">
<property name="siblings">
<constraint name="GreaterThanOrEqual">
5
<option name="value">5</option>
</constraint>
</property>
<property name="age">
Expand Down Expand Up @@ -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

Expand All @@ -134,7 +136,9 @@ that a date must at least be the current day:

<class name="App\Entity\Order">
<property name="deliveryDate">
<constraint name="GreaterThanOrEqual">today</constraint>
<constraint name="GreaterThanOrEqual">
<option name="value">today</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down Expand Up @@ -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

Expand All @@ -193,7 +198,9 @@ dates. If you want to fix the timezone, append it to the date string:

<class name="App\Entity\Order">
<property name="deliveryDate">
<constraint name="GreaterThanOrEqual">today UTC</constraint>
<constraint name="GreaterThanOrEqual">
<option name="value">today UTC</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down Expand Up @@ -241,7 +248,8 @@ current time:
App\Entity\Order:
properties:
deliveryDate:
- GreaterThanOrEqual: +5 hours
- GreaterThanOrEqual:
value: +5 hours

.. code-block:: xml

Expand All @@ -253,7 +261,9 @@ current time:

<class name="App\Entity\Order">
<property name="deliveryDate">
<constraint name="GreaterThanOrEqual">+5 hours</constraint>
<constraint name="GreaterThanOrEqual">
<option name="value">+5 hours</option>
</constraint>
</property>
</class>
</constraint-mapping>
Expand Down
5 changes: 3 additions & 2 deletions reference/constraints/IdenticalTo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ The following constraints ensure that:
App\Entity\Person:
properties:
firstName:
- IdenticalTo: Mary
- IdenticalTo:
value: Mary
age:
- IdenticalTo:
value: 20
Expand All @@ -67,7 +68,7 @@ The following constraints ensure that:
<class name="App\Entity\Person">
<property name="firstName">
<constraint name="IdenticalTo">
Mary
<option name="value">Mary</option>
</constraint>
</property>
<property name="age">
Expand Down
Loading
Loading