Review main Merged

89832[FEATURE] Allow usage of Symfony validators in Extbase

Elias Häußler CR +2 V +2 Hard +699 −62 updated 10/01/25, 17:40

Commit message

This patch adds support for Symfony Validators in Extbase. Validators
are built from Symfony Constraints which can be added as attributes to
domain properties and controller methods. Once a constraint attribute
is detected when reflecting properties and methods, it will be decorated
by a new `ConstraintDecoratingValidator` class, which is compatible to
Extbase's `ValidatorInterface`.

Decorated constraints may contain localizable messages. If a resulting
message contains valid LLL: syntax, the localization label will be
translated properly. The decorating validator also takes care of
messages parameters and internally converts them from named parameters
such as `{{ value }}` to sprintf-compatible parameters like `%1$s`.

Most of the available constraints such as `#[NotBlank]` and `#[Regex]`
can be used. However, more complex validators like `FileValidator` are
currently not compatible to the available implementation within Extbase,
since they are very strong bound to the Symfony Framework. Compatibility
with those validators and constraints may be added in the future.

Executed commands:

  composer req symfony/validator:^7.2

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Torben Hansen +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oliver Klee +1
    • Torben Hansen +1
    • core-ci +1 CI

Issues 1

Files 18

Review log 3248

Show 1523 earlier messages
  1. Elias Häußler uploaded patch set 1 06/24/25, 08:58

  2. Elias Häußler marked it work in progress 06/24/25, 08:58

  3. core-ci voted on patch set 1 V -1 06/24/25, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80704

  4. Elias Häußler uploaded patch set 2 V -1 06/24/25, 09:22

  5. core-ci voted on patch set 2 V -1 06/24/25, 09:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80710

  6. Elias Häußler uploaded patch set 3 V -1 06/24/25, 09:48

  7. Elias Häußler uploaded patch set 4 06/24/25, 09:49

  8. core-ci voted on patch set 3 V -1 06/24/25, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80717

  9. core-ci voted on patch set 4 V +1 06/24/25, 10:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80718

  10. Elias Häußler uploaded patch set 5 V +1 08/07/25, 18:54

  11. core-ci voted on patch set 5 V +1 08/07/25, 19:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82874

  12. Elias Häußler uploaded patch set 6 V +1 08/07/25, 19:08

  13. Elias Häußler marked it ready for review 08/07/25, 19:08

  14. core-ci voted on patch set 6 V +1 08/07/25, 19:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82879

  15. Mathias Brodala commented on patch set 6 08/07/25, 19:32

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:56

    I guess it would be good practice to follow the Symfony convention: use Symfony\Component\Validator\Constraints as Assert; #[Assert\Iban] This also makes it easier to read. See https://symfony.com/doc/current/validation.html#the-basics-of-validation

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:57

    How about being "modern" here and have a public property instead? The getters/setters don't really add anything here.
  16. Elias Häußler uploaded patch set 7 V +1 08/07/25, 19:42

  17. Elias Häußler commented on patch set 7 08/07/25, 19:56

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:56 Reply

    Done

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:57 Reply

    I'm not sure if we should mix too many "changes" here, since this could lead to confusion. Readers should focus on the new attributes; having additional changes from the current "established behavior" could make the actual change less understandable. But I don't have any hard feelings here :)
  18. core-ci voted on patch set 7 V +1 08/07/25, 19:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82893

  19. Georg Ringer voted on patch set 7 CR +1 08/09/25, 09:31

  20. Elias Häußler uploaded patch set 8 CR +1 V +1 08/12/25, 07:43

  21. core-ci voted on patch set 8 V +1 08/12/25, 07:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83177

  22. Elias Häußler wrote 08/21/25, 06:55

    Topic set to extbase
  23. Elias Häußler uploaded patch set 9 V +1 09/10/25, 18:55

  1. core-ci voted on patch set 9 V +1 09/10/25, 19:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84799

  2. Georg Ringer uploaded patch set 10 V +1 09/12/25, 09:19

  3. core-ci voted on patch set 10 V +1 09/12/25, 09:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84903

  4. Garvin Hicking uploaded patch set 11 V +1 09/19/25, 09:59

  5. core-ci voted on patch set 11 V +1 09/19/25, 10:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85157

  6. Garvin Hicking commented on patch set 11 09/24/25, 19:44

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:57 Reply

    I would agree. Current TYPO3 docs uses getters and setters for now, and I would like to have that on-par with the docs. getters/setters have the benfit of "gating" access and/or modifying values, and PHP 8 hooks there are not usable in TYPO3 yet (due to 8.2 min). I am quite sure we will revisit this once hooks will be more wide-spread and battle-tested. I'll resolve this and hope this is agreeable.
  7. Garvin Hicking uploaded patch set 12 V +1 09/24/25, 20:59

  8. core-ci voted on patch set 12 V -1 09/24/25, 21:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85467

  9. Garvin Hicking uploaded patch set 13 V -1 09/24/25, 21:18

  10. core-ci voted on patch set 13 V +1 09/24/25, 21:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85468

  11. Garvin Hicking commented on patch set 13 CR +1 V +1 09/24/25, 21:28

    (I added some low-level tests to "proof" that validators work and have mix-and-match-ability for extbase+symfony next to each other)

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:54

    This one (and country) requires "symfony/intl" which is not a dependency of ours. Should we use a different example, or also include symfony/intl as a dependency?!
  12. Elias Häußler uploaded patch set 14 CR +1 V +1 09/26/25, 06:45

  13. Elias Häußler uploaded patch set 15 09/26/25, 06:47

  14. Elias Häußler commented on patch set 15 09/26/25, 06:48

    Feature-106945-AllowUsageOfSymfonyValidatorsInExtbase.rst:54 Reply

    Thanks for your hint. I exchanged both validators (BIC and Country) with other validators, which don't require additional Symfony components.
  15. core-ci voted on patch set 14 V +1 09/26/25, 06:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85569

  16. core-ci voted on patch set 15 V +1 09/26/25, 06:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85570

  17. Garvin Hicking voted on patch set 15 CR +1 V +1 09/26/25, 07:08

  18. Oliver Klee voted on patch set 15 V +1 09/30/25, 14:55

  19. Torben Hansen voted on patch set 15 CR +1 V +1 10/01/25, 16:24

  20. Garvin Hicking uploaded patch set 16 CR +1 V +1 10/01/25, 17:19

  21. Torben Hansen voted on patch set 16 CR +1 V +1 10/01/25, 17:20

  22. Oliver Klee voted on patch set 16 V +1 10/01/25, 17:23

  23. core-ci voted on patch set 16 V +1 10/01/25, 17:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85832

  24. Garvin Hicking commented on patch set 16 CR +2 V +2 10/01/25, 17:33

    Thank you!! :-)
  25. Garvin Hicking merged patch set 17 10/01/25, 17:40