You are here

class Event in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Event.php \Symfony\Component\EventDispatcher\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

34 files declare their use of Event
AbstractEventDispatcherTest.php in vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
ConfigCollectionInfo.php in core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
Contains \Drupal\Core\Config\ConfigCollectionInfo.
ConfigCrudEvent.php in core/lib/Drupal/Core/Config/ConfigCrudEvent.php
Contains \Drupal\Core\Config\ConfigCrudEvent.
ConfigImporterEvent.php in core/lib/Drupal/Core/Config/ConfigImporterEvent.php
Contains \Drupal\Core\Config\ConfigImporterEvent.
ConfigModuleOverridesEvent.php in core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
Contains \Drupal\Core\Config\ConfigModuleOverridesEvent.

... See full list

8 string references to 'Event'
GenericEventTest::setUp in vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
Prepares the environment before running a test.
GenericEventTest::testConstruct in vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
GenericEventTest::testGetArgument in vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
GenericEventTest::testGetArguments in vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
Tests Event->getArgs().
GenericEventTest::testHasIterator in vendor/symfony/event-dispatcher/Tests/GenericEventTest.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 EventDispatcher 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

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.