1. 8.5.x vendor/symfony/event-dispatcher/Event.php Event
  2. 8.0.x vendor/symfony/event-dispatcher/Event.php Event
  3. 8.1.x vendor/symfony/event-dispatcher/Event.php Event
  4. 8.2.x vendor/symfony/event-dispatcher/Event.php Event
  5. 8.3.x vendor/symfony/event-dispatcher/Event.php Event
  6. 8.4.x vendor/symfony/event-dispatcher/Event.php Event
  7. 8.6.x vendor/symfony/event-dispatcher/Event.php Event

Event is the base class for classes containing event data.

This class contains no event data. It is used by events that do not pass state information to an event handler when an event is raised.

You can call the method stopPropagation() to abort the execution of further listeners in your event listener.

@author Guilherme Blanco <guilhermeblanco@hotmail.com> @author Jonathan Wage <jonwage@gmail.com> @author Roman Borschel <roman@code-factory.org> @author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

  • class \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of Event

28 files declare their use of Event
ConfigCollectionInfo.php in core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
ConfigCrudEvent.php in core/lib/Drupal/Core/Config/ConfigCrudEvent.php
ConfigImporterEvent.php in core/lib/Drupal/Core/Config/ConfigImporterEvent.php
ConfigModuleOverridesEvent.php in core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
ConsoleEvent.php in vendor/symfony/console/Event/ConsoleEvent.php

... See full list

File

vendor/symfony/event-dispatcher/Event.php, line 28

Namespace

Symfony\Component\EventDispatcher
View source
class Event {

  /**
   * @var bool Whether no further event listeners should be triggered
   */
  private $propagationStopped = false;

  /**
   * @var EventDispatcherInterface Dispatcher that dispatched this event
   */
  private $dispatcher;

  /**
   * @var string This event's name
   */
  private $name;

  /**
   * Returns whether further event listeners should be triggered.
   *
   * @see Event::stopPropagation()
   *
   * @return bool Whether propagation was already stopped for this event
   */
  public function isPropagationStopped() {
    return $this->propagationStopped;
  }

  /**
   * Stops the propagation of the event to further event listeners.
   *
   * If multiple event listeners are connected to the same event, no
   * further event listener will be triggered once any trigger calls
   * stopPropagation().
   */
  public function stopPropagation() {
    $this->propagationStopped = true;
  }

  /**
   * Stores the EventDispatcher that dispatches this Event.
   *
   * @param EventDispatcherInterface $dispatcher
   *
   * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
   */
  public function setDispatcher(EventDispatcherInterface $dispatcher) {
    $this->dispatcher = $dispatcher;
  }

  /**
   * Returns the EventDispatcher that dispatches this Event.
   *
   * @return EventDispatcherInterface
   *
   * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
   */
  public function getDispatcher() {
    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED);
    return $this->dispatcher;
  }

  /**
   * Gets the event's name.
   *
   * @return string
   *
   * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
   */
  public function getName() {
    @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED);
    return $this->name;
  }

  /**
   * Sets the event's name property.
   *
   * @param string $name The event name
   *
   * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
   */
  public function setName($name) {
    $this->name = $name;
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher Deprecated public function Returns the EventDispatcher that dispatches this Event.
Event::getName Deprecated public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher Deprecated public function Stores the EventDispatcher that dispatches this Event.
Event::setName Deprecated public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.