Skip to content

Commit 79fca6f

Browse files
committed
handling both mapping exception
1 parent 60b0e27 commit 79fca6f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
1717
use Doctrine\ORM\EntityManagerInterface;
1818
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
19-
use Doctrine\ORM\Mapping\MappingException;
19+
use Doctrine\ORM\Mapping\MappingException as ORMMappingException;
20+
use Doctrine\Common\Persistence\Mapping\MappingException as PersistenceMappingException;
2021
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
2122
use Symfony\Bridge\Doctrine\ManagerRegistry;
2223
use Symfony\Bundle\MakerBundle\Util\ClassNameDetails;
@@ -132,7 +133,7 @@ public function getMetadata(string $classOrNamespace = null, bool $disconnected
132133
if ($disconnected) {
133134
try {
134135
$loaded = $cmf->getAllMetadata();
135-
} catch (MappingException $e) {
136+
} catch (PersistenceMappingException | ORMMappingException $e) {
136137
$loaded = $cmf instanceof AbstractClassMetadataFactory ? $cmf->getLoadedMetadata() : [];
137138
}
138139

0 commit comments

Comments
 (0)