Bug #57164
closedNumberRangeValidator does not get options correctly
100%
Description
The validation always fails when I add the following annotation in my model * @validate NumberRange(minimum=1,maximum=999)
Adding DEBUG info to the NumberRangeValidator I see that $this->options[] does not get filled correctly. Only $this->options['minimum'] gets filled. $this->options['maximum'] is not set.
Unfortunately I don´t find the right place to check why the second option doesn´t get filled.
I see that something is weired there but I cannot go more into it - sorry :-(
BTW:
I´d been great if only one option could be mandatory because actually I´d like to check "Greater than" with only providing the 'minimum' option.
Files
Updated by Thomas Hucke over 10 years ago
- File AbstractValidator.patch AbstractValidator.patch added
Tested with TYPO3 6.2.0rc1 now all given options are read successfully.
But still the default values in $supportedOptions are not recognized.
With the attached patch the code in AbstractCompositeValidator gets reused to keep track of supported/unsupported options.
You may use it as it is.
Updated by Thomas Hucke over 10 years ago
- File AbstractValidator.patch AbstractValidator.patch added
Sorry - removed debug output from patch
Updated by Thomas Hucke over 10 years ago
- File AbstractValidator.patch AbstractValidator.patch added
Next fix:
Removed setting $this->options in deprecated method setOptions() according to AbstractCompositeValidator.
Values set in constructor got removed when method is being called e.g. by ValidatorResolver
Updated by Thomas Hucke over 10 years ago
- File AbstractValidator.patch AbstractValidator.patch added
Final shot of this patch ;-)
Moved the whole code of the construtor to setOptions() and calling that from the constructor.
Added a TODO hint to move code back to the constructor when deprecated method setOptions() gets removed.
That should provide backward compatibility for all cases.
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28922
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28922
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28922
Updated by Gerrit Code Review over 10 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28938
Updated by Marc Bastian Heinrichs over 10 years ago
Thomas, could you test new patch set https://review.typo3.org/28938 ? Thx
Updated by Thomas Hucke over 10 years ago
Hallo Marc,
I´ve tested successfully the modification in my environment.
The reported issue has been resolved.
Thank you very much
Thomas
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28938
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28938
Updated by Gerrit Code Review over 10 years ago
Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29142
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29142
Updated by Stefan Neufeind over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 3c0c6a0bf8e8fc1f6a7124a31d5fe10fb10d7a49.
Updated by Thomas Hucke over 10 years ago
Hallo Stefan,
would you please check my comment on the patch.
I´m afraid we have to make another correction.
Sorry for my late test - I'm at work during day and only have limited time to go for those tasks.
Thomas
Updated by Thomas Hucke over 10 years ago
Issue has been resolved.
My test was false - tested 6.1 patch on 6.2 :-(
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed