Dispatcher implements SingletonInterface
A dispatcher which dispatches signals by calling its registered slot methods and passing them the method arguments which were originally passed to the signal method.
will be removed in TYPO3 v12.0. Use PSR-14 based events and EventDispatcherInterface instead.
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $logger : LoggerInterface
- $objectManager : ObjectManagerInterface
- $slots : array<string|int, mixed>
- Information about all slots connected a certain signal.
Methods
- __construct() : mixed
- connect() : void
- Connects a signal with a slot.
- dispatch() : mixed
- Dispatches a signal by calling the registered Slot methods
- getSlots() : array<string|int, mixed>
- Returns all slots which are connected with the given signal
Properties
$logger
protected
LoggerInterface
$logger
$objectManager
protected
ObjectManagerInterface
$objectManager
$slots
Information about all slots connected a certain signal.
protected
array<string|int, mixed>
$slots
= []
Indexed by [$signalClassName][$signalMethodName] and then numeric with an array of information about the slot
Methods
__construct()
public
__construct(ObjectManagerInterface $objectManager, LoggerInterface $logger) : mixed
Parameters
- $objectManager : ObjectManagerInterface
- $logger : LoggerInterface
connect()
Connects a signal with a slot.
public
connect(string $signalClassName, string $signalName, mixed $slotClassNameOrObject[, string $slotMethodName = '' ][, bool $passSignalInformation = true ]) : void
One slot can be connected with multiple signals by calling this method multiple times.
Parameters
- $signalClassName : string
-
Name of the class containing the signal
- $signalName : string
-
Name of the signal
- $slotClassNameOrObject : mixed
-
Name of the class containing the slot or the instantiated class or a Closure object
- $slotMethodName : string = ''
-
Name of the method to be used as a slot. If $slotClassNameOrObject is a Closure object, this parameter is ignored
- $passSignalInformation : bool = true
-
If set to TRUE, the last argument passed to the slot will be information about the signal (EmitterClassName::signalName)
Tags
dispatch()
Dispatches a signal by calling the registered Slot methods
public
dispatch(string $signalClassName, string $signalName[, array<string|int, mixed> $signalArguments = [] ]) : mixed
Parameters
- $signalClassName : string
-
Name of the class containing the signal
- $signalName : string
-
Name of the signal
- $signalArguments : array<string|int, mixed> = []
-
arguments passed to the signal method
Tags
getSlots()
Returns all slots which are connected with the given signal
public
getSlots(string $signalClassName, string $signalName) : array<string|int, mixed>
Parameters
- $signalClassName : string
-
Name of the class containing the signal
- $signalName : string
-
Name of the signal
Return values
array<string|int, mixed> —An array of arrays with slot information