1<?php
2
3namespace Drupal\Core\Entity;
4
5use Symfony\Component\EventDispatcher\GenericEvent;
6
7/**
8 * Defines a base class for all entity type events.
9 */
10class EntityTypeEvent extends GenericEvent {
11
12  /**
13   * The entity type.
14   *
15   * @var \Drupal\Core\Entity\EntityTypeInterface
16   */
17  protected $entityType;
18
19  /**
20   * The original entity type.
21   *
22   * @var \Drupal\Core\Entity\EntityTypeInterface
23   */
24  protected $original;
25
26  /**
27   * Constructs a new EntityTypeEvent.
28   *
29   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
30   *   The field storage definition.
31   * @param \Drupal\Core\Entity\EntityTypeInterface $original
32   *   (optional) The original entity type. This should be passed only when
33   *   updating the entity type.
34   */
35  public function __construct(EntityTypeInterface $entity_type, EntityTypeInterface $original = NULL) {
36    $this->entityType = $entity_type;
37    $this->original = $original;
38  }
39
40  /**
41   * The entity type the event refers to.
42   *
43   * @return \Drupal\Core\Entity\EntityTypeInterface
44   */
45  public function getEntityType() {
46    return $this->entityType;
47  }
48
49  /**
50   * The original entity type.
51   *
52   * @return \Drupal\Core\Entity\EntityTypeInterface
53   */
54  public function getOriginal() {
55    return $this->original;
56  }
57
58}
59