TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\SignalSlot\Dispatcher Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\SignalSlot\Dispatcher:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 initializeObject ()
 
 connect ($signalClassName, $signalName, $slotClassNameOrObject, $slotMethodName='', $passSignalInformation=true)
 
 dispatch ($signalClassName, $signalName, array $signalArguments=[])
 
 getSlots ($signalClassName, $signalName)
 

Protected Attributes

 $isInitialized = false
 
 $objectManager
 
 $slots = []
 

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.

Definition at line 24 of file Dispatcher.php.

Member Function Documentation

◆ connect()

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

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

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

Definition at line 76 of file Dispatcher.php.

◆ dispatch()

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

Dispatches a signal by calling the registered Slot methods

Parameters
string$signalClassNameName of the class containing the signal
string$signalNameName of the signal
array$signalArgumentsarguments passed to the signal method
Returns
mixed
Exceptions
Exception

Definition at line 114 of file Dispatcher.php.

References TYPO3\CMS\Extbase\SignalSlot\Dispatcher\initializeObject().

◆ getSlots()

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

Returns all slots which are connected with the given signal

Parameters
string$signalClassNameName of the class containing the signal
string$signalNameName of the signal
Returns
array An array of arrays with slot information

Definition at line 168 of file Dispatcher.php.

◆ initializeObject()

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

Initializes this object.

This methods needs to be used as alternative to inject aspects. Since this dispatches is used very early when the ObjectManager is not fully initialized (especially concerning caching framework), this is the only way.

Returns
void

Definition at line 55 of file Dispatcher.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

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

Member Data Documentation

◆ $isInitialized

TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$isInitialized = false
protected

Definition at line 29 of file Dispatcher.php.

◆ $objectManager

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

Definition at line 34 of file Dispatcher.php.

◆ $slots

TYPO3\CMS\Extbase\SignalSlot\Dispatcher::$slots = []
protected

Definition at line 43 of file Dispatcher.php.