Review main Merged

78917[BUGFIX] Allow ViewHelpers from libraries

Simon Praetorius CR +2 V +2 Normal +97 −86 updated 06/05/23, 18:53

Commit message

With TYPO3 11 it was possible to use ViewHelpers from composer libraries
that aren't TYPO3 extensions and thus don't use Symfony dependency
injection. With the removal of objectManager, this doesn't work anymore
in TYPO3 12 because the dependency injection can only instantiate
ViewHelper classes that are defined as public services explicitly.

This change reintroduces that functionality by falling back to "new" if
the class exists but isn't registered as a service. Fluid standalone
uses the same method to instantiate a ViewHelper.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Anja Leichsenring +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Anja Leichsenring +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 2333

Show 58 earlier messages
  1. Simon Praetorius uploaded patch set 1 05/02/23, 09:39

  2. Simon Praetorius updated the commit message in patch set 2 05/02/23, 09:40

  3. core-ci voted on patch set 1 V +1 05/02/23, 09:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41342

  4. core-ci voted on patch set 2 V +1 05/02/23, 09:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41343

  5. Oliver Klee commented on patch set 2 05/02/23, 10:18

    Could we cover this with a regression test?
  6. Simon Praetorius uploaded patch set 3 V +1 05/02/23, 11:22

  7. core-ci voted on patch set 3 V -1 05/02/23, 11:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41344

  8. Simon Praetorius uploaded patch set 4 V -1 05/02/23, 12:48

  1. core-ci voted on patch set 4 V -1 05/02/23, 12:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41351

  2. Simon Praetorius uploaded patch set 5 V -1 05/02/23, 13:13

  3. core-ci voted on patch set 5 V +1 05/02/23, 13:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41353

  4. Christian Kuhn commented on patch set 5 CR -1 05/02/23, 14:00

    -1 for now, will review, but looks good already.
  5. Benni Mack updated the commit message in patch set 6 CR -1 V +1 05/03/23, 09:50

  6. Simon Praetorius uploaded patch set 7 05/15/23, 19:26

  7. Simon Praetorius uploaded patch set 8 05/15/23, 19:29

  8. core-ci voted on patch set 7 V -1 05/15/23, 19:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41847

  9. core-ci voted on patch set 8 V -1 05/15/23, 19:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41848

  10. Simon Praetorius uploaded patch set 9 V -1 05/15/23, 19:54

  11. core-ci voted on patch set 9 V +1 05/15/23, 20:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41853

  12. Christian Kuhn commented on patch set 9 05/18/23, 15:12

    this should go to 12.4 as well.
  13. Christian Kuhn uploaded patch set 10 V +1 05/18/23, 15:13

  14. Oliver Klee voted on patch set 10 V +1 CR +1 05/18/23, 15:16

  15. Christian Kuhn voted on patch set 10 V +1 CR +1 05/18/23, 15:18

  16. core-ci voted on patch set 10 V +1 05/18/23, 15:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41905

  17. Stefan Bürk commented on patch set 10 CR -1 05/20/23, 21:57

    composer.json:7

    It's a causal goot practice to have code in a package in a subfolder, e.g. "src/" or like for the TYPO3 world for extensension "/Classes". As a separation from test sources, e.g. "Tests/", "tests/" etc. So I would opt here to have the viewhelper in the non-extension example package at least in a subfolder `src/` to match with the casual good sense/good practive for package structure. Even it's technical correct to use the corrent way. Additionally, I would opt for adding a ``` "type": "library", ``` line to express this as a library. Even if the composer.json validates without it. But it makes clear that this is intended to be a "non TYPO3 extension" package.

    ViewhelperLibraryTest.php:29

    Can we add at least a small comment that this tests a viewhelper from a normal composer package and not a TYPO3 extension, and that the "test" package resides in "path" ... ? As it is not a extension, it cannot be referenced with "testExtensionsToLoad" .. but if we move forward to build functional test instances composer based instead of leagacy, it may be necessary to add something to a property so the test extension is added in the test instance and so it would not be missed here. Not sure abot making it a @todo though.
  18. Stefan Bürk commented on patch set 10 05/20/23, 21:59

    Services.yaml:44

    Do we really need to remove this ? This acts as a example how people can register viewhelpers over DI, so I would not remove them. And it's possibible to integrate something to list DI registered viewhelpers to belisted (and missing core viewhelpers than). I would rather keep them even if not strictly needed anymore with the current patch.
  19. Simon Praetorius uploaded patch set 11 CR +1 V +1 05/21/23, 16:46

  20. Simon Praetorius commented on patch set 11 05/21/23, 16:48

    Services.yaml:44 Reply

    Removing them was suggested by lolli, not sure how he thinks about it now?
  21. Stefan Bürk commented on patch set 11 05/21/23, 16:51

    Services.yaml:44 Reply

    Leave 'em removed for now. Will talk with him separatly then.
  22. core-ci voted on patch set 11 V +1 05/21/23, 16:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41946

  23. Anja Leichsenring voted on patch set 11 V +1 CR +1 05/23/23, 04:47

  24. Stefan Bürk commented on patch set 11 V +2 CR +2 06/05/23, 18:53

    composer.json:7 Reply

    Done

    ViewhelperLibraryTest.php:29 Reply

    Done
  25. Stefan Bürk merged patch set 12 06/05/23, 18:53