Skip to content

Commit fa881c1

Browse files
committed
[#2027] Backporting changes from @l3l0 on XML validation code
1 parent 5bab81f commit fa881c1

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

reference/constraints/Blank.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ of an ``Author`` class were blank, you could do the following:
4343
protected $firstName;
4444
}
4545
46+
.. code-block:: xml
47+
48+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
49+
<class name="Acme\BlogBundle\Entity\Author">
50+
<property name="firstName">
51+
<constraint name="Blank" />
52+
</property>
53+
</class>
54+
4655
Options
4756
-------
4857

reference/constraints/MaxLength.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Basic Usage
4747
<class name="Acme\BlogBundle\Entity\Blog">
4848
<property name="summary">
4949
<constraint name="MaxLength">
50-
<value>100</value>
50+
<option name="limit">100</option>
5151
</constraint>
5252
</property>
5353
</class>

reference/constraints/NotBlank.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ were not blank, you could do the following:
4242
protected $firstName;
4343
}
4444
45+
.. code-block:: xml
46+
47+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
48+
<class name="Acme\BlogBundle\Entity\Author">
49+
<property name="firstName">
50+
<constraint name="NotBlank" />
51+
</property>
52+
</class>
53+
4554
Options
4655
-------
4756

reference/constraints/NotNull.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ were not strictly equal to ``null``, you would:
4242
protected $firstName;
4343
}
4444
45+
.. code-block:: xml
46+
47+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
48+
<class name="Acme\BlogBundle\Entity\Author">
49+
<property name="firstName">
50+
<constraint name="NotNull" />
51+
</property>
52+
</class>
53+
4554
Options
4655
-------
4756

reference/constraints/Null.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ of an ``Author`` class exactly equal to ``null``, you could do the following:
4646
protected $firstName;
4747
}
4848
49+
.. code-block:: xml
50+
51+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
52+
<class name="Acme\BlogBundle\Entity\Author">
53+
<property name="firstName">
54+
<constraint name="Null" />
55+
</property>
56+
</class>
57+
4958
Options
5059
-------
5160

0 commit comments

Comments
 (0)