Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Support \DateInterval in comparison constraints#33401
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
9f86290 to2554641Compare… (fancyweb)This PR was squashed before being merged into the 3.4 branch (closes#33434).Discussion----------[Validator] Add ConstraintValidator::formatValue() tests| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -So#33401 tests can be built on top of this.Commits-------b688aa3 [Validator] Add ConstraintValidator::formatValue() tests
… (fancyweb)This PR was squashed before being merged into the 3.4 branch (closes #33434).Discussion----------[Validator] Add ConstraintValidator::formatValue() tests| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Sosymfony/symfony#33401 tests can be built on top of this.Commits-------b688aa31ec [Validator] Add ConstraintValidator::formatValue() tests
af34089 to9a19842Compare9a19842 to1b0654aCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
1b0654a to0c7342dCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Validator/Util/DateIntervalComparisonHelper.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
0c7342d to1664890CompareUh oh!
There was an error while loading.Please reload this page.
xabbuh commentedOct 15, 2019
I find the PR description a bit confusing. Is the goal of this PR to support specifying intervals as an input of the constraints or do you really want to be able to have your properties being intervals? From reading I understand the latter, but I don't really see a use case for that. |
fancyweb commentedOct 15, 2019
The latter. A class property holds a |
| 'h' =>'hour', | ||
| 'i' =>'minute', | ||
| 's' =>'second', | ||
| 'f' =>'microsecond', |
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 formatting logic is English-only, which looks bad.
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.
As we did for dates just above, the format is hardcoded here except in this case there are words.
1664890 to3c5df46Comparefancyweb commentedFeb 3, 2020
I just rebased this one on master. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
fancyweb commentedFeb 10, 2020
I must admit there is a problem on this one with the hardcoded English formatting that does not follow any standard (contrary to the hardcoded RFC-3339 date format). How could we deal with this? |
3c5df46 tof4b9bf6Compareseb-jean commentedJul 7, 2020
This feature would be very interesting :) |
fancyweb commentedAug 18, 2020
@fabpot I am closing this one as it cannot be merged with a fixed format. I am still working on the format customisation sometimes but it is not ready yet. I will reopen a new PR once everything is ready. |
Uh oh!
There was an error while loading.Please reload this page.
That feature allows to use the
Rangeand all comparisons constraints on\DateIntervalvalues.TODO :
ConstraintValidator::formatValue()withPRETTY_DATE_INTERVALComparisonValidatorDateIntervalHelperDivisibleBy- this constraint is a comparison and there is no test with dates, so I guess a proper exception needs to be thrown. - see[Validator] Only handle numeric values in DivisibleBy #33435Edit : waiting for other related PRs to be treated before resynchronizing everything on this one.