Chris@0: . Chris@0: */ Chris@0: Chris@0: namespace Doctrine\Common\Persistence\Event; Chris@0: Chris@0: use Doctrine\Common\EventArgs; Chris@0: use Doctrine\Common\Persistence\ObjectManager; Chris@0: Chris@0: /** Chris@0: * Provides event arguments for the onClear event. Chris@0: * Chris@0: * @link www.doctrine-project.org Chris@0: * @since 2.2 Chris@0: * @author Roman Borschel Chris@0: * @author Benjamin Eberlei Chris@0: */ Chris@0: class OnClearEventArgs extends EventArgs Chris@0: { Chris@0: /** Chris@0: * @var \Doctrine\Common\Persistence\ObjectManager Chris@0: */ Chris@0: private $objectManager; Chris@0: Chris@0: /** Chris@0: * @var string|null Chris@0: */ Chris@0: private $entityClass; Chris@0: Chris@0: /** Chris@0: * Constructor. Chris@0: * Chris@0: * @param ObjectManager $objectManager The object manager. Chris@0: * @param string|null $entityClass The optional entity class. Chris@0: */ Chris@0: public function __construct($objectManager, $entityClass = null) Chris@0: { Chris@0: $this->objectManager = $objectManager; Chris@0: $this->entityClass = $entityClass; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Retrieves the associated ObjectManager. Chris@0: * Chris@0: * @return \Doctrine\Common\Persistence\ObjectManager Chris@0: */ Chris@0: public function getObjectManager() Chris@0: { Chris@0: return $this->objectManager; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the name of the entity class that is cleared, or null if all are cleared. Chris@0: * Chris@0: * @return string|null Chris@0: */ Chris@0: public function getEntityClass() Chris@0: { Chris@0: return $this->entityClass; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns whether this event clears all entities. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function clearsAllEntities() Chris@0: { Chris@0: return ($this->entityClass === null); Chris@0: } Chris@0: }