Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] deprecate the allowEmptyString option#13695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:masterfromxabbuh:issue-13692
May 24, 2020
Merged
Changes fromall 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
13 changes: 8 additions & 5 deletionsreference/constraints/Length.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,8 +42,7 @@ and "50", you might add the following:
* min = 2,
* max = 50,
* minMessage = "Your first name must be at least {{ limit }} characters long",
* maxMessage = "Your first name cannot be longer than {{ limit }} characters",
* allowEmptyString = false
* maxMessage = "Your first name cannot be longer than {{ limit }} characters"
* )
*/
protected $firstName;
Expand All@@ -60,7 +59,6 @@ and "50", you might add the following:
max: 50
minMessage: 'Your first name must be at least {{ limit }} characters long'
maxMessage: 'Your first name cannot be longer than {{ limit }} characters'
allowEmptyString: false

.. code-block:: xml

Expand All@@ -81,7 +79,6 @@ and "50", you might add the following:
<option name="maxMessage">
Your first name cannot be longer than {{ limit }} characters
</option>
<option name="allowEmptyString">false</option>
</constraint>
</property>
</class>
Expand All@@ -104,7 +101,6 @@ and "50", you might add the following:
'max' => 50,
'minMessage' => 'Your first name must be at least {{ limit }} characters long',
'maxMessage' => 'Your first name cannot be longer than {{ limit }} characters',
'allowEmptyString' => false,
]));
}
}
Expand All@@ -119,6 +115,13 @@ allowEmptyString

**type**: ``boolean`` **default**: ``false``

.. deprecated:: 5.2

The ``allowEmptyString`` option is deprecated since Symfony 5.2. If you
want to allow empty strings too, combine the ``Length`` constraint with
the :doc:`Blank constraint </reference/constraints/Blank>` inside the
:doc:`AtLeastOneOf constraint </reference/constraints/AtLeastOneOf>`.

If set to ``true``, empty strings are considered valid (which is the same
behavior as previous Symfony versions). The default ``false`` value considers
empty strings not valid.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp