Review main Merged

80309[FEATURE] Introduce PHP attribute to autoconfigure event listeners

Sascha Nowak CR +2 V +2 Normal +170 −0 updated 08/03/23, 21:04

Commit message

A new custom PHP attribute "AsEventListener" is added in
order to autoconfigure a class as an event listener.

The attributes is repeatable, which allows to register
the same class to listen for different events.

The attribute features the same functionality as
the manual registration in Services.(yaml|php) file.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1622

  1. Sascha Nowak uploaded patch set 1 08/03/23, 12:09

  2. core-ci voted on patch set 1 V -1 08/03/23, 12:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44924

  3. Sascha Nowak uploaded patch set 2 V -1 08/03/23, 12:18

  4. core-ci voted on patch set 2 V +1 08/03/23, 12:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44925

  5. Mathias Brodala commented on patch set 2 08/03/23, 12:39

  6. Sascha Nowak commented on patch set 2 08/03/23, 13:29

    Reply

    The symfony event is not fully api compatible as it uses priority instead of before and after. If these two properties are not relevant at all, I can remove my own implementation and use the symfony attribute
  7. Mathias Brodala commented on patch set 2 08/03/23, 13:35

    Reply

    True, that's a considerable difference. So a custom attribute for TYPO3 makes sense. Maybe consider using the same name: https://github.com/symfony/symfony/pull/40556
  8. Sascha Nowak uploaded patch set 3 V +1 08/03/23, 16:27

  9. core-ci voted on patch set 3 V +1 08/03/23, 16:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44933

  10. Oli Bartsch commented on patch set 3 08/03/23, 19:23

    Great patch! Works already quite well! Could you please check my remarks, which are mostly just documentation things?
    Please let's add a commit message, describing what this patch does in more detail.

    AsEventListener.php:20

    This import is unused.

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:24

    Let's add something like "The attributes is repeatable, which allows to register the same class to listen for different events."

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:45

    I think it would be great to show a migration from Services.yaml definition to using the attribute.

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:50

    Could we please mention the reason here again => auto tagging => auto configuration?
  11. Sascha Nowak uploaded patch set 4 V +1 08/03/23, 20:20

  12. Sascha Nowak commented on patch set 4 08/03/23, 20:22

    Reply

    Done
    Hey Oliver, thanks for your feedback

    Reply

    Done

    AsEventListener.php:20 Reply

    Done

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:24 Reply

    Done

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:45 Reply

    Done

    Feature-101544-IntroducePHPAttributeToAutoconfigureEventListeners.rst:50 Reply

    Done
  13. core-ci voted on patch set 4 V +1 08/03/23, 20:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44968

  14. Oli Bartsch uploaded patch set 5 V +1 08/03/23, 20:45

  15. Oli Bartsch commented on patch set 5 V +1 CR +1 08/03/23, 20:46

    Reply

    Done
  16. Oli Bartsch uploaded patch set 6 CR +1 V +1 08/03/23, 20:50

  17. Andreas Kienast voted on patch set 6 V +1 CR +1 08/03/23, 20:50

  18. Oli Bartsch voted on patch set 6 V +1 CR +1 08/03/23, 20:51

  19. core-ci voted on patch set 6 V +1 08/03/23, 21:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44976

  20. core-ci voted on patch set 5 V +1 08/03/23, 21:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44975

  21. Oli Bartsch voted on patch set 6 V +2 CR +2 08/03/23, 21:03

  22. Oli Bartsch merged patch set 7 08/03/23, 21:04