Project

General

Profile

Actions

Bug #57164

closed

NumberRangeValidator does not get options correctly

Added by Thomas Hucke over 10 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2014-03-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

AbstractValidator.patch (1.52 KB) AbstractValidator.patch Adds check on supportedOptions in constructor Thomas Hucke, 2014-03-22 13:18
AbstractValidator.patch (1.33 KB) AbstractValidator.patch Thomas Hucke, 2014-03-22 13:39
AbstractValidator.patch (1.37 KB) AbstractValidator.patch Thomas Hucke, 2014-03-22 15:26
AbstractValidator.patch (1.48 KB) AbstractValidator.patch Thomas Hucke, 2014-03-22 16:35
Actions #1

Updated by Thomas Hucke over 10 years ago

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.

Actions #2

Updated by Thomas Hucke over 10 years ago

Sorry - removed debug output from patch

Actions #3

Updated by Thomas Hucke over 10 years ago

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

Actions #4

Updated by Thomas Hucke over 10 years ago

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.

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

Updated by Marc Bastian Heinrichs over 10 years ago

Thomas, could you test new patch set https://review.typo3.org/28938 ? Thx

Actions #10

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

Actions #11

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

Actions #12

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

Actions #13

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

Actions #14

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

Actions #15

Updated by Stefan Neufeind over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

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

Actions #17

Updated by Thomas Hucke over 10 years ago

Issue has been resolved.
My test was false - tested 6.1 patch on 6.2 :-(

Actions #18

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF