Deprecation: #102326 - RegularExpressionValidator validator option "errorMessage"
See forge#102326
Description
The
error
validator option provides a custom string
as error message for validation failures of the
Regular
.
In order to streamline error message translation keys with other validators,
the
error
validator option has been marked as deprecated in
TYPO3 v13 and will be removed in TYPO3 v14.
Impact
Using the
error
validator option with the
Regular
will trigger a PHP deprecation warning.
Affected installations
TYPO3 installations using the validator option
error
with the
Regular
.
Migration
The new
message
validator option should be used to provide a custom
translatable error message for failed validation.
Before:
use TYPO3\CMS\Extbase\Annotation as Extbase;
#[Extbase\Validate([
'validator' => 'RegularExpression',
'options' => [
'regularExpression' => '/^simple[0-9]expression$/',
'errorMessage' => 'Error message or LLL schema string',
],
])]
protected string $myProperty = '';
After:
use TYPO3\CMS\Extbase\Annotation as Extbase;
#[Extbase\Validate([
'validator' => 'RegularExpression',
'options' => [
'regularExpression' => '/^simple[0-9]expression$/',
'message' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:my.languageKey'
],
])]
protected string $myProperty = '';