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] NotBlank: add a new option to allow null values#29641

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:masterfromdunglas:notblank_allow_null
Jan 29, 2019

Conversation

@dunglas
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#27876
LicenseMIT
Doc PRtodo

This PR adds a new option to the@NotBlank constraint to allow null values. As described in#27876, this is particularly useful when creating web APIs.

alamirault, nicholasruunu, edamov, and mayro reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to thenext milestoneDec 19, 2018
@nicolas-grekas
Copy link
Member

ping@dunglas

@dunglas
Copy link
MemberAuthor

Should be ready now

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you please also add an entry to the changelog?

@fabpot
Copy link
Member

Thank you@dunglas.

@fabpotfabpot merged commit484d22a intosymfony:masterJan 29, 2019
fabpot added a commit that referenced this pull requestJan 29, 2019
…alues (dunglas)This PR was squashed before being merged into the 4.3-dev branch (closes#29641).Discussion----------[Validator] NotBlank: add a new option to allow null values| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |#27876| License       | MIT| Doc PR        | todoThis PR adds a new option to the `@NotBlank` constraint to allow null values. As described in#27876, this is particularly useful when creating web APIs.Commits-------484d22a [Validator] NotBlank: add a new option to allow null values
@javiereguiluz
Copy link
Member

I've createdsymfony/symfony-docs#10954 to document this new feature.@dunglas please always remember to create at least an issue in Symfony Docs to not forget about documenting new features. Thanks!

@dunglas
Copy link
MemberAuthor

Sorry about that@javiereguiluz.

javiereguiluz reacted with thumbs up emoji

@dunglasdunglas deleted the notblank_allow_null branchFebruary 1, 2019 10:22
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestFeb 1, 2019
…aviereguiluz)This PR was merged into the master branch.Discussion----------Document the allowNull option for NotBlank constraintThis documentssymfony/symfony#29641Commits-------ab2c4f1 Document the allowNull option for NotBlank constraint
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
fabpot added a commit that referenced this pull requestJul 3, 2019
…reject empty strings (ogizanagi)This PR was merged into the 4.4 branch.Discussion----------[Validator] Add a Length::$allowEmptyString option to reject empty strings| Q             | A| ------------- | ---| Branch?       | 4.4 <!-- see below -->| Bug fix?      | no| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | Todo (change the warning on top ofhttps://symfony.com/doc/current/reference/constraints/Length.html)which defaults to `true` in 4.4 but will trigger a deprecation if not set explicitlyin order to make the default `false` in 5.0.While it could be solved now thanks to#29641 by using both `@Length(min=1)` & `@NotBlank(allowNull=true)` constraints,as expressed in#27876 (comment) and following comments, the `@Length(min=1)` behavior doesn't match our expectations when reading it: it feels logical to invalidate empty strings, but it actually doesn't.Hence the proposal of making the behavior of rejecting empty strings the default in 5.0.In my opinion, the flag could even be removed later.Commits-------e113e7f [Validator] Add a Length::$allowEmptyString option to reject empty strings
@typomedia
Copy link

👍@fabpot pls. merge this option to Symfony 3.4 🙌

@xabbuh
Copy link
Member

@typomedia New features are never added in patch releases.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lyrixxlyrixxlyrixx left review comments

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

9 participants

@dunglas@nicolas-grekas@fabpot@javiereguiluz@typomedia@xabbuh@lyrixx@ro0NL@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp