File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ NotBlank
2
2
========
3
3
4
4
Validates that a value is not blank - meaning not equal to a blank string,
5
- a blank array, ``false `` or ``null ``. To check that a value is not equal to
6
- ``null ``, see the :doc: `/reference/constraints/NotNull ` constraint.
5
+ a blank array, ``false `` or ``null `` (null behavior is configurable). To check
6
+ that a value is not equal to ``null ``, see the
7
+ :doc: `/reference/constraints/NotNull ` constraint.
7
8
8
9
+----------------+------------------------------------------------------------------------+
9
10
| Applies to | :ref: `property or method <validation-property-target >` |
10
11
+----------------+------------------------------------------------------------------------+
11
- | Options | - `message `_ |
12
+ | Options | - `allowNull `_ |
13
+ | | - `message `_ |
12
14
| | - `payload `_ |
13
15
+----------------+------------------------------------------------------------------------+
14
16
| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ NotBlank ` |
@@ -81,6 +83,18 @@ class were not blank, you could do the following:
81
83
Options
82
84
-------
83
85
86
+ allowNull
87
+ ~~~~~~~~~
88
+
89
+ **type **: ``bool `` **default **: ``false ``
90
+
91
+ If set to ``true ``, ``null `` values are considered valid and won't trigger a
92
+ constraint violation.
93
+
94
+ .. versionadded :: 4.3
95
+
96
+ The ``allowNull `` option was introduced in Symfony 4.3.
97
+
84
98
message
85
99
~~~~~~~
86
100
You can’t perform that action at this time.
0 commit comments