You are here

public function EventManager::dispatchEvent in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/common/lib/Doctrine/Common/EventManager.php \Doctrine\Common\EventManager::dispatchEvent()

Dispatches an event to all registered listeners.

Parameters

string $eventName The name of the event to dispatch. The name of the event is: the name of the method that is invoked on listeners.

EventArgs|null $eventArgs The event arguments to pass to the event handlers/listeners.: If not supplied, the single empty EventArgs instance is used.

Return value

boolean

File

vendor/doctrine/common/lib/Doctrine/Common/EventManager.php, line 53

Class

EventManager
The EventManager is the central point of Doctrine's event listener system. Listeners are registered on the manager and events are dispatched through the manager.

Namespace

Doctrine\Common

Code

public function dispatchEvent($eventName, EventArgs $eventArgs = null) {
  if (isset($this->_listeners[$eventName])) {
    $eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
    foreach ($this->_listeners[$eventName] as $listener) {
      $listener
        ->{$eventName}($eventArgs);
    }
  }
}