Skip to content

Commit 2664394

Browse files
committed
bug #289 Class not found on make:entity --regenerate (mertoksuz, weaverryan)
This PR was merged into the 1.0-dev branch. Discussion ---------- Class not found on make:entity --regenerate That PR fixes #207. Commits ------- a3a621c using a more specific try-catch 9e45f42 test fix 79fca6f handling both mapping exception
2 parents 4338ebb + a3a621c commit 2664394

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Doctrine/DoctrineHelper.php

Lines changed: 5 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,9 @@ public function getMetadata(string $classOrNamespace = null, bool $disconnected
132133
if ($disconnected) {
133134
try {
134135
$loaded = $cmf->getAllMetadata();
135-
} catch (MappingException $e) {
136+
} catch (ORMMappingException $e) {
137+
$loaded = $cmf instanceof AbstractClassMetadataFactory ? $cmf->getLoadedMetadata() : [];
138+
} catch (PersistenceMappingException $e) {
136139
$loaded = $cmf instanceof AbstractClassMetadataFactory ? $cmf->getLoadedMetadata() : [];
137140
}
138141

0 commit comments

Comments
 (0)