Bug #101541
openThe type of validator options is not respected
0%
Description
When extending \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
to write a custom validator having options, for example when doing this in combination with ext:form
, one has to specifiy the $supportedOptions
array inside the validator class, like so
protected $supportedOptions = [
'optionOne' => [1, 'Some option', 'int'],
'optionTwo' => [5, 'another option', 'int']
];
Containing the type of the value as the third array element.
When I dump what is in the final values in my options ($this->getOptions()
or directly $this->options
) I can see that the int
cast is not happening. For example, when using this in combination with ext:form
the option values come from the YAML which contains strings. So my options does contain '5'
instead of 5
.
Shouldn't the configured option types in some way be respected (at least in the documentation of this API)? What I'm saying: I'm not even sure whether I just made a bug report, or even a feature request or simply reported missing/inconsistent documentation.
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/Extbase/Reference/Domain/Validator.html has nothing about it. What is the intention of this configuration? Is this a left-over or planned to be used in the future?