So I was working on a project today, and an event subscriber we had written the better part of a year ago was determined to no longer be firing. Here is the definition:
services: my_module.event_subscriber: class: Drupalmy_moduleEventSubscriberXYZFeeds tags: - { name: event_subscriber }
I went through the normal debugging, and found that the event was not being added to the registry. Further debugging uncovered that having the name contain event_subscriber
was causing it to not get picked up. If I changed that to anything else it would work, for example:
services: my_module.my_module_xyz_subscriber: class: Drupalmy_moduleEventSubscriberXYZFeeds tags: - { name: event_subscriber }
I cannot find any documentation that explicitly states that you cannot use that phrase in a service name.The only convention I am aware of is to always prefix the service name with the module it comes from.
Did something change from D8 to D9, or does this come from the Symfony Framework components that are part of Drupal?