Task #104733
closed[DOCS] Use createValidator instead of addValidator in the code example for EXT:form API when setting options
100%
Description
Since #96998, there's no more __construct() method more in Extbase validators, thus they can't be instanciated with options anymore, they have to implement setOptions.
The following code doesn't work since TYPO3v12 :
$message->addValidator(GeneralUtility::makeInstance(StringLengthValidator::class, ['minimum' => 5, 'maximum' => 20]));
Instead the method createValidator must be used like this :
$message->createValidator(
'StringLength',
['minimum' => 5, 'maximum' => 20]
);
The form extension documentation contains a code example on how to build forms programmatically that must be updated to respect this (
https://docs.typo3.org/c/typo3/cms-form/main/en-us/D/FrontendRendering/Index.html#apireference-frontendrendering-programmatically )
I'll try to provide a patch (that would be my first contribution using the official gerrit process).
Updated by Sébastien Delcroix 3 months ago
- Subject changed from [DOCS] Use createValidator instead of addValidator in the code example for EXT:form API to [DOCS] Use createValidator instead of addValidator in the code example for EXT:form API when setting options
Updated by Gerrit Code Review 3 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85779
Updated by Gerrit Code Review 3 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85779
Updated by Christian Kuhn 3 months ago
- Related to Task #96998: Streamline Extbase validators added
Updated by Gerrit Code Review 3 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85779
Updated by Gerrit Code Review 3 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85782
Updated by Sébastien Delcroix 3 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 36bf9ab7fac3b90911a1623276d5938f04078a91.