Create a class which extends SymfonyComponentEventDispatcherEvent
.
Then, use the event dispatcher service to dispatch the event:
$eventDispatcher = $container->get('event_dispatcher');
$eventDispatcher->dispatch('custom.event.identifier', $event);
You can register your event listener service like so:
tags:
- { name: kernel.event_listener, event: custom.event.identifier, method: onCustomEvent }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…