-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
8000
[Validator] what about to have MinCount and MaxCount validators #2674
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Feature
Good first issue
Ideal for your first contribution! (some Symfony experience may be required)
Validator
Comments
I agree.
I have a preference for the first solution. |
It also could be one valldator |
Yes, I think it's better |
@bschussek what do you think about it ? |
I would prefer a |
Task for the BHD: Change SizeValidator to accept any Countable object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature
Good first issue
Ideal for your first contribution! (some Symfony experience may be required)
Validator
Let's say we have a bloger which can assign from one to five tags to his blog. While submiting the server should count tags and check whether the collection in the allowed range. It can be done with
Choice
validator andmin
andmax
options. But in this case we have such problems:$repository->findAll()
From another side we have
Min\Max
andMinLength\MaxLength
validators but they very restrictive (the first takes only integers and second one only strings)So I am thinking of moving count validation rules from Choice to a new validators called
MinCount
andMaxCount
BTW I can do a PR if you find it useful.
The text was updated successfully, but these errors were encountered: