1
0
mirror of synced 2025-02-20 22:23:14 +03:00

#1120 - cleaning up try-catch code when fetching metadata

This commit is contained in:
Marco Pivetta 2014-10-19 18:14:33 +02:00
parent 100766e360
commit 97fdd0adb7

View File

@ -19,6 +19,7 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Doctrine\Common\Persistence\Mapping\MappingException;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
@ -172,8 +173,8 @@ EOT
private function getClassMetadata($entityName, EntityManagerInterface $entityManager)
{
try {
$meta = $entityManager->getClassMetadata($entityName);
} catch (\Doctrine\Common\Persistence\Mapping\MappingException $e) {
return $entityManager->getClassMetadata($entityName);
} catch (MappingException $e) {
$mappedEntities = $this->getMappedEntities($entityManager);
$matches = array_filter($mappedEntities, function ($mappedEntity) use ($entityName) {
if (preg_match('{' . preg_quote($entityName) . '}', $mappedEntity)) {
@ -198,9 +199,9 @@ EOT
$entityName, implode(', ', $matches)
));
}
}
return $meta;
return $meta;
}
}
/**