From 7f4c37658312c01806220dcbcc011ee7e2272e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 4 Feb 2019 09:03:02 +0100 Subject: [PATCH] Detect doctrine bridge version Although it is in the PropertyInfo sub namespace, the DoctrineExtractor class is in the doctrine bridge, which means we should detect the doctrine bridge version and not the PropertyInfo component version. Fixes #883, Closes #884 --- DependencyInjection/DoctrineExtension.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 828876cf2..6651aadad 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -9,6 +9,7 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory; use Doctrine\ORM\Version; use LogicException; +use ReflectionClass; use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension; use Symfony\Bridge\Doctrine\Form\Type\DoctrineType; use Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware; @@ -25,7 +26,6 @@ use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\Form\AbstractType; use Symfony\Component\Messenger\MessageBusInterface; -use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface; /** * DoctrineExtension is an extension for the Doctrine DBAL and ORM library. @@ -800,7 +800,7 @@ 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)) { + if ((new ReflectionClass(DoctrineExtractor::class))->hasProperty('entityManager')) { $argumentId = sprintf('doctrine.orm.%s_entity_manager', $entityManagerName); } else { $argumentId = sprintf('doctrine.orm.%s_entity_manager.metadata_factory', $entityManagerName);