Feature: #94345 - Auto-detect event types
See forge#94345
Description
If no "event" tag is specified on an event listener in Services.yaml, the event is automatically derived from the event method itself using reflection.
Impact
In the vast majority of cases, the "event" tag on an event listener in Services.yaml is no longer necessary.
Given this example event listener implementation:
final class CategoryPermissionsAspect
{
public function addUserPermissionsToCategoryTreeData(ModifyTreeDataEvent $event): void
{
// ...
}
}
Copied!
With this registration:
TYPO3\CMS\Backend\Security\CategoryPermissionsAspect:
tags:
- name: event.listener
identifier: 'backend-user-permissions'
method: 'addUserPermissionsToCategoryTreeData'
event: TYPO3\CMS\Core\Tree\Event\ModifyTreeDataEvent
Copied!
The event:
tag can be omitted, since it's automatically read from
the method signature add
of the listener implementation:
TYPO3\CMS\Backend\Security\CategoryPermissionsAspect:
tags:
- name: event.listener
identifier: 'backend-user-permissions'
method: 'addUserPermissionsToCategoryTreeData'
Copied!