Skip to content

Commit a3a621c

Browse files
authored
using a more specific try-catch
1 parent 9e45f42 commit a3a621c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ public function getMetadata(string $classOrNamespace = null, bool $disconnected
133133
if ($disconnected) {
134134
try {
135135
$loaded = $cmf->getAllMetadata();
136-
} catch (\Throwable $e) {
137-
if (!$e instanceof ORMMappingException && !$e instanceof PersistenceMappingException) {
138-
throw $e;
139-
}
136+
} catch (ORMMappingException $e) {
137+
$loaded = $cmf instanceof AbstractClassMetadataFactory ? $cmf->getLoadedMetadata() : [];
138+
} catch (PersistenceMappingException $e) {
140139
$loaded = $cmf instanceof AbstractClassMetadataFactory ? $cmf->getLoadedMetadata() : [];
141140
}
142141

0 commit comments

Comments
 (0)