2
0

PreCreateEvent.php 840 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace PhpDevCommunity\PaperORM\Event;
  3. use PhpDevCommunity\Listener\Event;
  4. use PhpDevCommunity\PaperORM\Entity\EntityInterface;
  5. use PhpDevCommunity\PaperORM\EntityManagerInterface;
  6. class PreCreateEvent extends Event
  7. {
  8. private EntityManagerInterface $em;
  9. private EntityInterface $entity;
  10. /**
  11. * PreCreateEvent constructor.
  12. *
  13. * @param EntityManagerInterface $em
  14. * @param EntityInterface $entity
  15. */
  16. public function __construct(EntityManagerInterface $em, EntityInterface $entity)
  17. {
  18. $this->entity = $entity;
  19. $this->em = $em;
  20. }
  21. public function getEntity(): EntityInterface
  22. {
  23. return $this->entity;
  24. }
  25. /**
  26. * @return EntityManagerInterface
  27. */
  28. public function getEm(): EntityManagerInterface
  29. {
  30. return $this->em;
  31. }
  32. }