Documentation

LegacyEventDispatcherProxy
in package
implements EventDispatcherInterface

FinalYes

A helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch().

This class should be deprecated in Symfony 5.1

Tags
author

Nicolas Grekas p@tchwork.com

Table of Contents

Interfaces

EventDispatcherInterface
The EventDispatcherInterface is the central point of Symfony's event listener system.

Properties

$dispatcher  : mixed

Methods

__call()  : mixed
Proxies all method calls to the original event dispatcher.
addListener()  : mixed
Adds an event listener that listens on the specified events.
addSubscriber()  : mixed
Adds an event subscriber.
decorate()  : EventDispatcherInterface|null
dispatch()  : object
Dispatches an event to all registered listeners.
getListenerPriority()  : int|null
Gets the listener priority for a specific event.
getListeners()  : array<string|int, mixed>
Gets the listeners of a specific event or all listeners sorted by descending priority.
hasListeners()  : bool
Checks whether an event has any registered listeners.
removeListener()  : mixed
Removes an event listener from the specified events.
removeSubscriber()  : mixed

Properties

Methods

__call()

Proxies all method calls to the original event dispatcher.

public __call(mixed $method, mixed $arguments) : mixed
Parameters
$method : mixed
$arguments : mixed

addListener()

Adds an event listener that listens on the specified events.

public addListener(mixed $eventName, mixed $listener[, mixed $priority = 0 ]) : mixed
Parameters
$eventName : mixed

The event to listen on

$listener : mixed

The listener

$priority : mixed = 0

The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)

dispatch()

Dispatches an event to all registered listeners.

public dispatch(mixed $event) : object
Parameters
$event : mixed

The event to pass to the event handlers/listeners

Return values
object

getListenerPriority()

Gets the listener priority for a specific event.

public getListenerPriority(mixed $eventName, mixed $listener) : int|null
Parameters
$eventName : mixed

The name of the event

$listener : mixed

The listener

Return values
int|null

The event listener priority

getListeners()

Gets the listeners of a specific event or all listeners sorted by descending priority.

public getListeners([mixed $eventName = null ]) : array<string|int, mixed>
Parameters
$eventName : mixed = null

The name of the event

Return values
array<string|int, mixed>

The event listeners for the specified event, or all event listeners by event name

hasListeners()

Checks whether an event has any registered listeners.

public hasListeners([mixed $eventName = null ]) : bool
Parameters
$eventName : mixed = null

The name of the event

Return values
bool

true if the specified event has any listeners, false otherwise

removeListener()

Removes an event listener from the specified events.

public removeListener(mixed $eventName, mixed $listener) : mixed
Parameters
$eventName : mixed

The event to remove a listener from

$listener : mixed

The listener to remove


        
On this page

Search results