コード例 #1
0
 /**
  * Test that a entity manager can be created.
  */
 public function testEntityManagerCreation()
 {
     $config = $this->createMock(Config::class);
     $cache = $this->createMock(Cache::class);
     $mappingDriver = $this->createMock(MappingDriver::class);
     $provider = new EntityManagerProvider($config, $cache, $mappingDriver);
     $this->assertInstanceOf(EntityManagerInterface::class, $provider->getEntityManager());
 }
コード例 #2
0
ファイル: Commander.php プロジェクト: gravitymedia/commander
 /**
  * Get entity manager.
  *
  * @return EntityManagerInterface
  *
  * @throws \LogicException
  */
 public function getEntityManager()
 {
     if (!$this->initialized) {
         throw new \LogicException('The entity manager is not available before initialization');
     }
     if (null === $this->entityManager) {
         $provider = new EntityManagerProvider($this->config, $this->getCache(), $this->getMappingDriver());
         $this->entityManager = $provider->getEntityManager();
     }
     return $this->entityManager;
 }