You are here

public function EventManager::dispatchEvent in Plug 7

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

lib/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);
    }
  }
}