Reputation: 708
I'm updating an extension for usage in TYPO3 v10 or higher and have an issue with a regular Expression validator, i don't know how to get in runnable in v10 or higher now. Tried the following:
/**
* action list
*
* @param string $filterChar
* @Extbase\Validate("RegularExpression",options={ "regularExpression": "/^[0-9A-Za-z]{0,1}$/i" })
* @return void
*/
public function listAction(string $filterChar = '') {
But i got the following exception:
Invalid validate annotation in ABC\MyExt\Controller\MyController->listAction(): The following validators have been defined for missing param "$": RegularExpression
What i'm doing wrong and how can i fix it, or what is the correct definition now for a RegularExpression validator for an action parameter?
Upvotes: 1
Views: 266
Reputation: 708
Found the solution. I had to add the param="..."
@Extbase\Validate("RegularExpression",options={ "regularExpression": "/^[0-9A-Za-z]{0,1}$/i" }, param="filterChar")
So the full solution looks like this:
/**
* action list
*
* @param string $filterChar
* @Extbase\Validate("RegularExpression",options={ "regularExpression":"/^[0-9A-Za-z]{0,1}$/i" }, param="filterChar")
* @return void
*/
public function listAction(string $filterChar = '') {
Upvotes: 3