TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\SignalSlot\Dispatcher Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\SignalSlot\Dispatcher:
TYPO3\CMS\Core\SingletonInterface Tx_Extbase_SignalSlot_Dispatcher

Public Member Functions

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

Protected Attributes

 $isInitialized = FALSE
 
 $objectManager
 
 $slots = array()
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! 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 23 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
boolean$passSignalInformationIf set to TRUE, the last argument passed to the slot will be information about the signal (EmitterClassName::signalName)
Exceptions

Definition at line 74 of file Dispatcher.php.

◆ dispatch()

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

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 109 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 162 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 54 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 28 of file Dispatcher.php.

◆ $objectManager

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

Definition at line 33 of file Dispatcher.php.

◆ $slots

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

Definition at line 42 of file Dispatcher.php.