/** * @return string[] */ protected function getSupportedEntityClasses() { $entities = []; $entityManagers = $this->entityManagerBag->getEntityManagers(); foreach ($entityManagers as $em) { $allMetadata = SafeDatabaseChecker::getAllMetadata($em); foreach ($allMetadata as $metadata) { if ($metadata->isMappedSuperclass) { continue; } if ($this->entityExclusionProvider->isIgnoredEntity($metadata->name)) { continue; } $entities[] = $metadata->name; } } return $entities; }
/** * @expectedException \Exception * @expectedExceptionMessage unexpected */ public function testGetAllMetadataShouldRethrowUnexpectedException() { $em = $this->getMock('Doctrine\\ORM\\EntityManagerInterface'); $em->expects($this->once())->method('getMetadataFactory')->willThrowException(new \Exception('unexpected')); SafeDatabaseChecker::getAllMetadata($em); }
/** * Makes sure that aliases for all entities are loaded */ protected function ensureAllAliasesLoaded() { if ($this->allAliasesLoaded) { return; } $allMetadata = SafeDatabaseChecker::getAllMetadata($this->doctrine->getManager()); foreach ($allMetadata as $metadata) { if (!$metadata->isMappedSuperclass && !isset($this->aliases[$metadata->name])) { $this->findEntityAlias($metadata->name); } } $this->allAliasesLoaded = true; }