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 33
44Validates that a given string length is *between * some minimum and maximum value.
55
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-
126========== ===================================================================
137Applies to :ref: `property or method <validation-property-target >`
14- Options - `charset `_
8+ Options - `allowEmptyString `_
9+ - `charset `_
1510 - `charsetMessage `_
1611 - `exactMessage `_
1712 - `groups `_
@@ -115,6 +110,20 @@ and "50", you might add the following:
115110Options
116111-------
117112
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+
118127charset
119128~~~~~~~
120129
You can’t perform that action at this time.
0 commit comments