Skip to content

Commit

Permalink
Fix doctrine#883 with support for php 5
Browse files Browse the repository at this point in the history
  • Loading branch information
silverbackdan committed Feb 3, 2019
1 parent dc8feee commit ab01108
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions DependencyInjection/DoctrineExtension.php
Expand Up @@ -800,9 +800,8 @@ protected function loadOrmCacheDrivers(array $entityManager, ContainerBuilder $c
private function loadPropertyInfoExtractor($entityManagerName, ContainerBuilder $container)
{
$propertyExtractorDefinition = $container->register(sprintf('doctrine.orm.%s_entity_manager.property_info_extractor', $entityManagerName), DoctrineExtractor::class);
if (interface_exists(PropertyInitializableExtractorInterface::class)) {
$argumentId = sprintf('doctrine.orm.%s_entity_manager', $entityManagerName);
} else {
$constructorParameterClass = (new \ReflectionClass(DoctrineExtractor::class))->getConstructor()->getParameters()[0]->getClass();
if ($constructorParameterClass !== null && $constructorParameterClass->getName() === ClassMetadataFactory::class) {
$argumentId = sprintf('doctrine.orm.%s_entity_manager.metadata_factory', $entityManagerName);

$metadataFactoryDefinition = $container->register($argumentId, ClassMetadataFactory::class);
Expand All @@ -811,6 +810,8 @@ private function loadPropertyInfoExtractor($entityManagerName, ContainerBuilder
'getMetadataFactory',
]);
$metadataFactoryDefinition->setPublic(false);
} else {
$argumentId = sprintf('doctrine.orm.%s_entity_manager', $entityManagerName);
}

$propertyExtractorDefinition->addArgument(new Reference($argumentId));
Expand Down

0 comments on commit ab01108

Please sign in to comment.