Skip to content

Commit 286311d

Browse files
gerfignaGermán Figna
authored and
Germán Figna
committed
Check Metadata Class info exists
Sometimes, Metadata ReflectionClass is null and throws: PHP Fatal error: Call to a member function getName() on a non-object in vendor/symfony-cmf/routing-bundle/Doctrine/RouteConditionMetadataListener.php on line 52 i.e. I get this error when I try to use doctrine:generate:entities command using orm persistence.
1 parent c5f919c commit 286311d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doctrine/RouteConditionMetadataListener.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
4949
}
5050

5151
$meta = $eventArgs->getClassMetadata();
52+
53+
if (null === $meta->getReflectionClass()) {
54+
return;
55+
}
56+
5257
if ($meta->getReflectionClass()->getName() !== 'Symfony\Component\Routing\Route') {
5358
return;
5459
}

0 commit comments

Comments
 (0)