‪TYPO3CMS  10.4
TYPO3\CMS\Extbase\SignalSlot\Dispatcher Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\SignalSlot\Dispatcher:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (ObjectManagerInterface $objectManager, LoggerInterface $logger)
 
 connect (string $signalClassName, string $signalName, $slotClassNameOrObject, string $slotMethodName='', bool $passSignalInformation=true)
 
mixed dispatch (string $signalClassName, string $signalName, array $signalArguments=[])
 
array getSlots (string $signalClassName, string $signalName)
 
 reportDeprecatedSignalSlots ()
 

Protected Attributes

ObjectManagerInterface $objectManager
 
array $slots = array( )
 
LoggerInterface $logger
 
string[][] $deprecatedSlots
 

Detailed Description

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.

Deprecated:
‪will be removed in TYPO3 v12.0. Use PSR-14 based events and EventDispatcherInterface instead.

Definition at line 125 of file Dispatcher.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\SignalSlot\Dispatcher::__construct ( ObjectManagerInterface  $objectManager,
LoggerInterface  $logger 
)
Parameters
ObjectManagerInterface$objectManager
LoggerInterface$logger

Definition at line 292 of file Dispatcher.php.

References TYPO3\CMS\Extbase\SignalSlot\Dispatcher\$logger, and TYPO3\CMS\Extbase\SignalSlot\Dispatcher\$objectManager.

Member Function Documentation

◆ connect()

TYPO3\CMS\Extbase\SignalSlot\Dispatcher::connect ( string  $signalClassName,
string  $signalName,
  $slotClassNameOrObject,
string  $slotMethodName = '',
bool  $passSignalInformation = true 
)

Connects a signal with a slot. One slot can be connected with multiple signals by calling this method multiple times.

Parameters
string$signalClassName‪Name of the class containing the signal
string$signalName‪Name of the signal
mixed$slotClassNameOrObject‪Name of the class containing the slot or the instantiated class or a Closure object
string$slotMethodName‪Name of the method to be used as a slot. If $slotClassNameOrObject is a Closure object, this parameter is ignored
bool$passSignalInformation‪If set to TRUE, the last argument passed to the slot will be information about the signal (EmitterClassName::signalName)
Exceptions

Definition at line 309 of file Dispatcher.php.

◆ dispatch()

mixed TYPO3\CMS\Extbase\SignalSlot\Dispatcher::dispatch ( string  $signalClassName,
string  $signalName,
array  $signalArguments = [] 
)

Dispatches a signal by calling the registered Slot methods

Parameters
string$signalClassName‪Name of the class containing the signal
string$signalName‪Name of the signal
array$signalArguments‪arguments passed to the signal method
Returns
‪mixed
Exceptions
Exception

Definition at line 346 of file Dispatcher.php.

◆ getSlots()

array TYPO3\CMS\Extbase\SignalSlot\Dispatcher::getSlots ( string  $signalClassName,
string  $signalName 
)

Returns all slots which are connected with the given signal

Parameters
string$signalClassName‪Name of the class containing the signal
string$signalName‪Name of the signal
Returns
‪array An array of arrays with slot information

Definition at line 406 of file Dispatcher.php.

◆ reportDeprecatedSignalSlots()

TYPO3\CMS\Extbase\SignalSlot\Dispatcher::reportDeprecatedSignalSlots ( )

This method is called by TYPO3\CMS\Extbase\Middleware\SignalSlotDeprecator to collect and report the deprecated slots only once per request.

Definition at line 417 of file Dispatcher.php.

Member Data Documentation

◆ $deprecatedSlots

string [][] TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$deprecatedSlots
protected

Definition at line 145 of file Dispatcher.php.

◆ $logger

LoggerInterface TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$logger
protected

Definition at line 141 of file Dispatcher.php.

Referenced by TYPO3\CMS\Extbase\SignalSlot\Dispatcher\__construct().

◆ $objectManager

ObjectManagerInterface TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$objectManager
protected

Definition at line 129 of file Dispatcher.php.

Referenced by TYPO3\CMS\Extbase\SignalSlot\Dispatcher\__construct().

◆ $slots

array TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$slots = array( )
protected

Information about all slots connected a certain signal. Indexed by [$signalClassName][$signalMethodName] and then numeric with an array of information about the slot

Definition at line 137 of file Dispatcher.php.