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] Added range constraint#3893

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

Closed
felds wants to merge1 commit intosymfony:masterfromfelds:master
Closed

[Validator] Added range constraint#3893

felds wants to merge1 commit intosymfony:masterfromfelds:master

Conversation

felds
Copy link
Contributor

When using the Min and Max constraints in combination and a non-numeric value is submitted, both show an "invalid" message at the same time.

Another approach that I can see could be making their type validation optional, ignoring every non-numeric value when asked to, but this would change their current API, and I don't think it's a smart move for something so critical as validation.

This new Constraint works around that by creating a combined min/max constraint without changing their existing API and also simplifying the configuration by reducing the number of annotations needed to perform this validation.

@vicb
Copy link
Contributor

@felds Your initial issue could be used by using validation groups (i.e. validate the numeric type before validating the value). So the only problem this is solving is saving some chars.

To be complete you should also update theValidatorTypeGuesser (see howMin andMax are used there).

@felds
Copy link
ContributorAuthor

@vicb do you mean running the validators twice?

@vicb
Copy link
Contributor

I mean using group sequences.

@felds
Copy link
ContributorAuthor

@vicb I didn't know about that (and google isn't helping). How can I learn more about that?

@vicb
Copy link
Contributor

There should be a couple of PR / issues that you can look for in Sf or Sf-doc (#2947 for example). I am not sure if this is already documented... Can you check ? (and if it is not, please create an issue or even better a PR)

@vicb
Copy link
Contributor

And also by looking at the tests

@jalliot
Copy link
Contributor

@felds Besides such a constraint already exists (at least in master, not sure about 2.0): theSize constraint.
The name may not be appropriate but it does the exact same thing.

@vicb
Copy link
Contributor

@jalliot you are right, thanks.@felds can you still check the doc ?

@jalliot
Copy link
Contributor

@vicb AFAIK @bschussek (or anyone else) never had time to write something in the doc about group sequences and he seems to be the only one who know them well enough.

I created an issue in the doc:symfony/symfony-docs#1248

@vicb
Copy link
Contributor

thanks

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@felds@vicb@jalliot

[8]ページ先頭

©2009-2025 Movatter.jp