Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Stale

95637[TASK] Introduce FieldValidationService for TCA field validation

Andreas Nedbal CR 0 V 0 Hard +738 −94 updated 09/04/26, 11:40

Commit message

DataHandler validates each submitted field value against its TCA
configuration inline, inside checkValue_* methods, mixed together
with type coercion and save-time side effects. There is currently
no way to run that same validation outside of a full save.

This introduces TYPO3\CMS\Core\Validation\FieldValidationService, a
standalone service that dispatches to one FieldTypeValidatorInterface
implementation per TCA field type. Implementations register via the
new #[AsFieldTypeValidator] attribute and a tagged service, mirroring
the existing FileRendererInterface/RendererRegistry pattern already
used elsewhere in core.

As a first, minimal proof of concept, DataHandler::checkValueForInput()
now delegates its validation logic to a new InputFieldTypeValidator.
Save-time side effects (the uniqueInPid/unique database checks) stay
in DataHandler, since they assume a save is imminent and are not
validation in the sense this service covers.
checkValue_input_Eval() and validateValueForRequired() now delegate
to the same canonical logic their extracted counterparts use, instead
of keeping a second, duplicated copy of it.

This is an internal refactor: DataHandler's observable behavior does
not change, verified by the existing DataHandler unit and functional
test suites passing unmodified.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/95637/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/95637/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Relation chain 3

  1. main 95639[TASK] Extract a read-only UniquenessChecker from DataHandler Based on this change Work in progress Merge conflict Andreas Nedbal CR 0 V -1 Hard +339 −56
  2. main 95638[TASK] Extend FieldValidationService to more TCA field types Based on this change Work in progress Merge conflict Andreas Nedbal CR 0 V 0 Expert +1000 −180
  3. 95637 [TASK] Introduce FieldValidationService for TCA field validation This change

Files 14

Review log 24

  1. Andreas Nedbal uploaded patch set 1 09/04/26, 10:05

  2. core-ci voted on patch set 1 V -1 09/04/26, 10:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107852

  3. Andreas Nedbal uploaded patch set 2 V -1 09/04/26, 11:28

  4. core-ci voted on patch set 2 V +1 09/04/26, 11:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107857