DumperEvent.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Drupal\reinstall;
  3. use Drupal\Core\Entity\EntityStorageInterface;
  4. use Symfony\Component\EventDispatcher\Event;
  5. /**
  6. * Wraps a dump event for event listeners.
  7. *
  8. * @see \Drupal\reinstall\ReinstallEvents::REINSTALL_SERIALIZE_POST
  9. * @see \Drupal\reinstall\ReinstallEvents::SERIALIZE_PRE
  10. */
  11. class DumperEvent extends Event {
  12. /**
  13. * The name of the bundle for which a dump is being performed.
  14. *
  15. * @var string
  16. */
  17. public $bundleName;
  18. /**
  19. * The entities to dump.
  20. *
  21. * @var \Drupal\Core\Entity\EntityInterface[]
  22. */
  23. public $entities = [];
  24. /**
  25. * The storage handler for the entity type of the entities to dump.
  26. *
  27. * @var \Drupal\Core\Entity\EntityStorageInterface
  28. */
  29. public $storage;
  30. /**
  31. * DumperEvent constructor.
  32. *
  33. * @param \Drupal\Core\Entity\EntityStorageInterface $storage
  34. * The entity storage.
  35. * @param string $bundleName
  36. * The name of the bundle being dumped.
  37. * @param array $entities
  38. * The entities to dump.
  39. */
  40. public function __construct(EntityStorageInterface $storage, string $bundleName, array $entities) {
  41. $this->storage = $storage;
  42. $this->bundleName = $bundleName;
  43. $this->entities = $entities;
  44. }
  45. }