LifecycleEventArgs.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Doctrine\Persistence\Event;
  3. use Doctrine\Common\EventArgs;
  4. use Doctrine\Persistence\ObjectManager;
  5. /**
  6. * Lifecycle Events are triggered by the UnitOfWork during lifecycle transitions
  7. * of entities.
  8. */
  9. class LifecycleEventArgs extends EventArgs
  10. {
  11. /** @var ObjectManager */
  12. private $objectManager;
  13. /** @var object */
  14. private $object;
  15. /**
  16. * @param object $object
  17. */
  18. public function __construct($object, ObjectManager $objectManager)
  19. {
  20. $this->object = $object;
  21. $this->objectManager = $objectManager;
  22. }
  23. /**
  24. * Retrieves the associated entity.
  25. *
  26. * @deprecated
  27. *
  28. * @return object
  29. */
  30. public function getEntity()
  31. {
  32. return $this->object;
  33. }
  34. /**
  35. * Retrieves the associated object.
  36. *
  37. * @return object
  38. */
  39. public function getObject()
  40. {
  41. return $this->object;
  42. }
  43. /**
  44. * Retrieves the associated ObjectManager.
  45. *
  46. * @return ObjectManager
  47. */
  48. public function getObjectManager()
  49. {
  50. return $this->objectManager;
  51. }
  52. }