/**
  * Returns the global entity manager.
  *
  * @return \Doctrine\ORM\EntityManagerInterface
  */
 public function getEntityManager()
 {
     if ($this->entityManager === null || !$this->entityManager->isOpen()) {
         $this->entityManager = $this->createEntityManager();
     }
     return $this->entityManager;
 }
 function it_should_throw_an_exception_if_em_is_closed(EntityManagerInterface $entityManager)
 {
     $entityManager->isOpen()->willReturn(false);
     $entityManager->beginTransaction()->shouldNotBeCalled();
     $this->shouldThrow('\\RemiSan\\TransactionManager\\Exception\\BeginException')->duringBeginTransaction();
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function isOpen()
 {
     return $this->wrapped->isOpen();
 }