-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Reintroduced Range constraint and created Count and Length constraints #4863
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
Conversation
{ | ||
public $minMessage = 'This value should be {{ limit }} or more'; | ||
public $maxMessage = 'This value should be {{ limit }} or less'; | ||
public $invalidMessage = 'This value should be a valid number'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this constraint doesnt support the exact number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
The |
Dude, nobody has time to fix the BC breaks you introduce :-) |
The changes to the |
Commits ------- a92f80b [Validator] Added Length constraint and deprecated MinLength and MaxLength 83a3f75 [Validator] Deprecated the constraints Min and Max in favor of Range 0cdacee [Validator] Removed MinCount and MaxCount and replaced them by the constraint Count 741c147 [Validator] Renamed deprecated Size constraint to Range Discussion ---------- [Validator] Reintroduced Range constraint and created Count and Length constraints Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: - After @Tobion's comment to #4851, this is the next try to streamline the constraints and reduce duplication of logic. The downside of the current MinLength/MaxLength and MinCount/MaxCount pairs is that they cannot output a fitting error message if a value should have an *exact* length/count. So this PR introduces * Range (formerly Size) to replace Min/Max * Count to replace MinCount/MaxCount * Length to replace MinLength/MaxLength Feedback is appreciated. --------------------------------------------------------------------------- by Tobion at 2012-07-11T20:40:08Z The `choice` constraint also cannot handle `min = max`. Or maybe we don't need these options on choice anymore as we can achieve the same with the new `count` constraint?! --------------------------------------------------------------------------- by beberlei at 2012-07-12T08:59:44Z Dude, nobody has time to fix the BC breaks you introduce :-) --------------------------------------------------------------------------- by TomAdam at 2012-07-12T12:38:49Z The changes to the `Size` validator yesterday broke my project, and I started rewriting to use `MaxLength / MinLength` validators today, until I spotted this. It would be good if this PR could have a reasonably high priority (whether or not it is accepted) as it will change how I fix my issues. I suspect a lot of people using the master branch will be in the same situation.
@TomAdam The PR is now merged. Sorry for the hassle. |
Much appreciated, and it's no hassle - we chose to work with 2.1, and it's been a great experience. |
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
After @Tobion's comment to #4851, this is the next try to streamline the constraints and reduce duplication of logic. The downside of the current MinLength/MaxLength and MinCount/MaxCount pairs is that they cannot output a fitting error message if a value should have an exact length/count. So this PR introduces
Feedback is appreciated.