You are here

class EntityEvent in Entity Events 2.0.x

Same name and namespace in other branches
  1. 8 src/Event/EntityEvent.php \Drupal\entity_events\Event\EntityEvent

Class to contain an entity event.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of EntityEvent

6 files declare their use of EntityEvent
EntityEventDeleteSubscriber.php in src/EventSubscriber/EntityEventDeleteSubscriber.php
EntityEventInsertSubscriber.php in src/EventSubscriber/EntityEventInsertSubscriber.php
EntityEventPresaveSubscriber.php in src/EventSubscriber/EntityEventPresaveSubscriber.php
EntityEventSubscriber.php in src/EventSubscriber/EntityEventSubscriber.php
EntityEventUpdateSubscriber.php in src/EventSubscriber/EntityEventUpdateSubscriber.php

... See full list

File

src/Event/EntityEvent.php, line 11

Namespace

Drupal\entity_events\Event
View source
class EntityEvent extends Event {

  /**
   * The Entity.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  private $entity;

  /**
   * The event type.
   *
   * @var \Drupal\entity_events\EntityEventType
   */
  private $eventType;

  /**
   * Construct a new entity event.
   *
   * @param string $event_type
   *   The event type.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity which caused the event.
   */
  public function __construct($event_type, EntityInterface $entity) {
    $this->entity = $entity;
    $this->eventType = $event_type;
  }

  /**
   * Method to get the entity from the event.
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * Method to get the event type.
   */
  public function getEventType() {
    return $this->eventType;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityEvent::$entity private property The Entity.
EntityEvent::$eventType private property The event type.
EntityEvent::getEntity public function Method to get the entity from the event.
EntityEvent::getEventType public function Method to get the event type.
EntityEvent::__construct public function Construct a new entity event.