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#36818

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
fabpot merged 1 commit intosymfony:masterfromxabbuh:issue-36812
May 22, 2020

Conversation

@xabbuh
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?no
Deprecations?yes
TicketsFix#36812
LicenseMIT
Doc PR

@derrabus
Copy link
Member

Can we deprecate theallowEmptyString option instead? If someone wanted to disallow empty strings, they could use theNotBlank validator instead, or am I missing something?

@xabbuhxabbuh changed the title[Validator] deprecate disallowing empty strings with minimum lengths[Validator] deprecate the "allowEmptyString" optionMay 20, 2020
@xabbuh
Copy link
MemberAuthor

Good idea, this was actually suggested when the option was introduced in 4.4 (see#31528):

In my opinion, the flag could even be removed later.

@xabbuhxabbuhforce-pushed theissue-36812 branch 4 times, most recently from6df1211 tofbbde1eCompareMay 21, 2020 08:53
@xabbuhxabbuhforce-pushed theissue-36812 branch 2 times, most recently from7f518d4 toa95b7a3CompareMay 22, 2020 13:22
@fabpot
Copy link
Member

Thank you@xabbuh.

@fabpotfabpot merged commite00017e intosymfony:masterMay 22, 2020
@xabbuhxabbuh deleted the issue-36812 branchMay 22, 2020 17:11
@nicolas-grekasnicolas-grekas modified the milestones:next,5.2Oct 5, 2020
@fabpotfabpot mentioned this pull requestOct 5, 2020
@xosofox
Copy link
Contributor

Just wondering how we can achieve the "old behaviour" now when combining min, max and allowEmptyString=true

It used to be "ok" to have have either an empty string OR apply min-max-constraints - this is gone now. Or am I missing something?

xosofox reacted with confused emoji

@xabbuh
Copy link
MemberAuthor

Precisely for such use cases you can combine theLength constraint with other constraints usingAtLeastOne (see the example in the upgrade guide):https://symfony.com/doc/current/reference/constraints/AtLeastOneOf.html

xosofox reacted with thumbs up emoji

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestApr 29, 2022
…rjohnson)This PR was merged into the 6.0 branch.Discussion----------[Validator] Update Length Validator Empty String DocsEmpty strings are no longer valid if a min is passed, null values stillvalidate.Changed in 6.0 along with dropping the deprecated `allowEmptyString`symfony/symfony#36818 option. There is some discussion that this is the intended behavior insymfony/symfony#45993Commits-------9fa967e Update Length Validator Empty String Docs
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@derrabusderrabusderrabus approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

[Validator] LengthValidator: allowEmptyString option set to false allows empty strings

7 participants

@xabbuh@derrabus@fabpot@xosofox@chalasr@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp