File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 3
3
4
4
Validates that a given string length is *between * some minimum and maximum value.
5
5
6
- .. caution ::
7
-
8
- ``null `` and empty strings are not handled by this constraint. You need to
9
- also add the :doc: `/reference/constraints/NotBlank ` or :doc: `/reference/constraints/NotNull `
10
- constraints to validate against these.
11
-
12
6
========== ===================================================================
13
7
Applies to :ref: `property or method <validation-property-target >`
14
- Options - `charset `_
8
+ Options - `allowEmptyString `_
9
+ - `charset `_
15
10
- `charsetMessage `_
16
11
- `exactMessage `_
17
12
- `groups `_
@@ -115,6 +110,20 @@ and "50", you might add the following:
115
110
Options
116
111
-------
117
112
113
+ allowEmptyString
114
+ ~~~~~~~~~~~~~~~~
115
+
116
+ **type **: ``boolean `` **default **: ``true ``
117
+
118
+ .. versionadded :: 4.4
119
+
120
+ The ``allowEmptyString `` option was introduced in Symfony 4.4.
121
+
122
+ When using the ``min `` option, it's mandatory to also define this option. If
123
+ set to ``true ``, empty strings are considered valid (which is the same behavior
124
+ as previous Symfony versions). Set it to ``false `` to consider empty strings not
125
+ valid.
126
+
118
127
charset
119
128
~~~~~~~
120
129
You can’t perform that action at this time.
0 commit comments