12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace Doctrine\Persistence\Event;
- use Doctrine\Common\EventArgs;
- use Doctrine\Persistence\ObjectManager;
- /**
- * Provides event arguments for the onClear event.
- */
- class OnClearEventArgs extends EventArgs
- {
- /** @var ObjectManager */
- private $objectManager;
- /** @var string|null */
- private $entityClass;
- /**
- * @param ObjectManager $objectManager The object manager.
- * @param string|null $entityClass The optional entity class.
- */
- public function __construct($objectManager, $entityClass = null)
- {
- $this->objectManager = $objectManager;
- $this->entityClass = $entityClass;
- }
- /**
- * Retrieves the associated ObjectManager.
- *
- * @return ObjectManager
- */
- public function getObjectManager()
- {
- return $this->objectManager;
- }
- /**
- * Returns the name of the entity class that is cleared, or null if all are cleared.
- *
- * @return string|null
- */
- public function getEntityClass()
- {
- return $this->entityClass;
- }
- /**
- * Returns whether this event clears all entities.
- *
- * @return bool
- */
- public function clearsAllEntities()
- {
- return $this->entityClass === null;
- }
- }
|