Skip to content

Commit

Permalink
Detect doctrine bridge version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
greg0ire committed Feb 4, 2019
1 parent dc8feee commit 7f4c376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DependencyInjection/DoctrineExtension.php
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7f4c376

Please sign in to comment.