Review main Merged

69419[TASK] Avoid ObjectManager in ext:fluid ViewHelperResolver

Christian Kuhn CR +2 V +2 Hard +213 −54 updated 06/17/21, 18:59

Commit message

Finish the ObjectManager usages in ext:fluid. With #94285
we made the ViewHelperResolver a singleton service, which
is not ok since it holds state: Namespaces are added at
runtime and they additionally depend on request.
The solution is similar to RenderingContext from #94285
though: Have a factory to create fresh instances for
each parsing cycle for this failsafe mode enabled class.
View helper instance prototypes itself are then retrieved
using GeneralUtility::makeInstance().

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 3

Files 8

Review log 1926

Show 1 earlier messages
  1. Christian Kuhn uploaded patch set 1 06/09/21, 19:22

  1. core-ci voted on patch set 1 V +1 06/09/21, 19:31 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12240

  2. Oli Bartsch voted on patch set 1 V +1 06/10/21, 20:16

  3. Benni Mack voted on patch set 1 CR +1 06/12/21, 10:55

  4. Benjamin Franzke commented on patch set 1 CR -1 06/12/21, 16:15

    ViewHelperResolver.php:82

    Hm, so this is only using `GeneralUtility::makeInstance` now, but I'm pretty sure that this will fail for ViewHelpers that rely on ObjectManager to inject dependencies. (So for ViewHelpers not configured via Services.yaml). I think we need to inject ContainerInterface and ObjectMananger into ViewHelperResolver (can injected by the factory, it is also available in failsafe mode) and then either instantiate via container (if available) or otherwise fall back to object mananger.
  5. Christian Kuhn commented on patch set 1 06/12/21, 16:24

    ViewHelperResolver.php:82 Reply

    yeah. will do.
  6. Christian Kuhn uploaded patch set 2 06/14/21, 22:03

  7. Christian Kuhn uploaded patch set 3 06/14/21, 22:12

  8. Christian Kuhn commented on patch set 3 CR -1 06/14/21, 22:13

    still not perfect, since OM is now used for all VH's of base typo3Fluid package ...
  9. core-ci voted on patch set 2 V -1 06/14/21, 22:13 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12436

  10. core-ci voted on patch set 3 V -1 06/14/21, 22:22 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12437

  11. Christian Kuhn uploaded patch set 4 06/14/21, 22:22

  12. core-ci voted on patch set 4 V -1 06/14/21, 22:33 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12438

  13. Christian Kuhn uploaded patch set 5 06/16/21, 22:15

  14. core-ci voted on patch set 5 V +1 06/16/21, 22:25 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12515

  15. Christian Kuhn commented on patch set 5 06/16/21, 22:27

    ViewHelperResolver.php:82 Reply

    Done
  16. Benni Mack commented on patch set 5 06/17/21, 12:12

    ViewHelperResolverFactory.php:33

    I think this should be marked as @internal
  17. Christian Kuhn uploaded patch set 6 06/17/21, 13:33

  18. Christian Kuhn commented on patch set 6 06/17/21, 13:34

    ViewHelperResolverFactory.php:33 Reply

    Done via final keyword.
  19. Christian Kuhn uploaded patch set 7 06/17/21, 13:35

  20. core-ci voted on patch set 6 V +1 06/17/21, 13:43 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12541

  21. core-ci voted on patch set 7 V +1 06/17/21, 13:48 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12542

  22. Benni Mack voted on patch set 7 V +1 CR +1 06/17/21, 14:09

  23. Benjamin Franzke voted on patch set 7 CR +1 06/17/21, 18:57

  24. Benjamin Franzke voted on patch set 7 V +2 CR +2 06/17/21, 18:59

  25. Benjamin Franzke merged patch set 8 06/17/21, 18:59