EntityTypeEvent.php 1.3 KB

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