TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
Dispatcher Class Reference
Inheritance diagram for Dispatcher:
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 extbase/Classes/SignalSlot/Dispatcher.php.

Member Function Documentation

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
InvalidArgumentException
Returns
void

Definition at line 76 of file extbase/Classes/SignalSlot/Dispatcher.php.

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
ExceptionInvalidSlotException if the slot is not valid
ExceptionInvalidSlotReturnException if a slot returns invalid arguments (too few or return value is not an array)

Definition at line 112 of file extbase/Classes/SignalSlot/Dispatcher.php.

References Dispatcher\initializeObject().

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 166 of file extbase/Classes/SignalSlot/Dispatcher.php.

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 extbase/Classes/SignalSlot/Dispatcher.php.

References GeneralUtility\makeInstance().

Referenced by Dispatcher\dispatch().

Member Data Documentation

$isInitialized = false
protected

Definition at line 29 of file extbase/Classes/SignalSlot/Dispatcher.php.

$objectManager
protected

Definition at line 34 of file extbase/Classes/SignalSlot/Dispatcher.php.

$slots = []
protected

Definition at line 43 of file extbase/Classes/SignalSlot/Dispatcher.php.