Review 11.5 Merged

73630[TASK] Allow DI for extbase validators

Christian Kuhn CR +2 V +2 Hard +457 −220 updated 02/22/22, 08:40

Commit message

With #92238, it has been postulated that Extbase
validators should not be dependency injection aware.
Further places following this idea have been done
in v11 with #94451 and #94384. A final breaking
ReST file has been added with #95026.

All of that is pretty unfortunate and there is
simply no reason that Extbase validators can
not get dependencies injected, no matter if
they're not singletons.

This patch specifically targets v11 to allow
dependency injection in Extbase validators again
if extension authors really need this, and don't
want to stick to manual dependency retrieval
as outlined in #95026. This patch should basically
mitigate issues for extension upgrades and paves
the way for a more solid general solution in v12.

Extension authors have a more smooth upgrade path,
especially when supporting two core versions at
the same time.

The v12 version of this patch is identical with
v11 for now - The breaking interface change,
adapting all core validators, and declaring core
validators 'final' in v12 will be done with a
dedicated v12 patch as soon as this
v11 tailored version has been aligned on.

Note all of this is pretty hairy and the solution
outlined with the patch for v11 hopefully gives the
maximum amount of compatibility without being
breaking again, with giving extension authors
additional options, and having v12 options to
further mitigate this complex mess.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 5

Files 22

Show 2 more files

Review log 2841

Show 916 earlier messages
  1. Christian Kuhn uploaded patch set 1 02/21/22, 11:27

  2. core-ci voted on patch set 1 V +1 02/21/22, 11:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23979

  3. Christian Kuhn uploaded patch set 2 02/21/22, 11:47

  4. core-ci voted on patch set 2 V -1 02/21/22, 11:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23981

  5. Christian Kuhn uploaded patch set 3 02/21/22, 12:40

  6. core-ci voted on patch set 3 V -1 02/21/22, 12:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23984

  7. Christian Kuhn commented on patch set 3 CR -1 02/21/22, 14:21

    still not the perfect strategy: the v11 change is far to big. will revamp.
  8. Christian Kuhn uploaded patch set 4 02/21/22, 15:07

  9. core-ci voted on patch set 4 V +1 02/21/22, 15:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23991

  10. Christian Kuhn uploaded patch set 5 02/21/22, 16:46

  11. Christian Kuhn updated the commit message in patch set 6 02/21/22, 16:47

  12. Christian Kuhn updated the commit message in patch set 7 02/21/22, 16:50

  13. Christian Kuhn updated the commit message in patch set 8 02/21/22, 16:55

  14. core-ci voted on patch set 5 V -1 02/21/22, 17:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23992

  15. core-ci voted on patch set 6 V -1 02/21/22, 17:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23993

  16. core-ci voted on patch set 7 V -1 02/21/22, 17:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23994

  1. Christian Kuhn uploaded patch set 9 02/21/22, 17:05

  2. core-ci voted on patch set 8 V -1 02/21/22, 17:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23995

  3. core-ci voted on patch set 9 V -1 02/21/22, 17:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23996

  4. Christian Kuhn uploaded patch set 10 02/21/22, 17:24

  5. core-ci voted on patch set 10 V +1 02/21/22, 17:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23997

  6. Christian Kuhn updated the commit message in patch set 11 02/21/22, 17:34

  7. core-ci voted on patch set 11 V +1 02/21/22, 17:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23999

  8. Christian Kuhn uploaded patch set 12 02/21/22, 18:22

  9. core-ci voted on patch set 12 V +1 02/21/22, 18:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24005

  10. Stefan Bürk voted on patch set 12 CR +1 02/21/22, 18:35

  11. Stefan Bürk voted on patch set 12 V +1 02/21/22, 18:40

  12. Stefan Froemken commented on patch set 12 02/21/22, 19:48

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:34

    typo ;-)

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:42

    IMO, please use only 3 spaces for first level indent
  13. Benni Mack commented on patch set 12 02/21/22, 20:02

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:42 Reply

    we changed this recently AFAIK
  14. Stefan Froemken commented on patch set 12 02/21/22, 20:13

    ValidatorInterface.php:47

    Please keep that on your list to change with v12, too.

    ValidatorResolverTest.php:75

    I don't like the approach to test mocked classes, but I understand that building the environment for "buildBaseValidatorConjunction" could be really hard, so for now, this is OK for me.

    AbstractRenderable.php:216

    Damn good. I'm sure I would forget that change here, if this was my patch ;-)
  15. Stefan Froemken commented on patch set 12 02/21/22, 20:17

    ValidatorInterface.php:21

    As you write "set Validator as shared: false in yaml" wouldn't it be good to add SingletonInterface here?
  16. Stefan Froemken commented on patch set 12 02/21/22, 20:30

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:42 Reply

  17. Oli Bartsch commented on patch set 12 02/21/22, 21:33

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:42 Reply

  18. Oli Bartsch voted on patch set 12 V +1 02/21/22, 21:49

  19. Christian Kuhn commented on patch set 12 02/22/22, 08:12

    Important-96332-ExtbaseValidatorsCanUseDependencyInjection.rst:34 Reply

    Done

    ValidatorInterface.php:21 Reply

    no: quite the opposite: validators have state and must not be shared. they're not singletons.

    ValidatorInterface.php:47 Reply

    Ack

    ValidatorResolverTest.php:75 Reply

    i only moved this down from setUp(). saw no good way to not mock here.

    AbstractRenderable.php:216 Reply

    Done
  20. Christian Kuhn uploaded patch set 13 02/22/22, 08:12

  21. core-ci voted on patch set 13 V +1 02/22/22, 08:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24030

  22. Benni Mack voted on patch set 13 V +1 CR +1 02/22/22, 08:29

  23. Oli Bartsch voted on patch set 13 V +1 CR +1 02/22/22, 08:33

  24. Christian Kuhn voted on patch set 13 V +2 CR +2 02/22/22, 08:40

  25. Christian Kuhn merged patch set 14 02/22/22, 08:40