diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 307b028bf..75fde439e 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -25,6 +25,7 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransportFactory; +use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface; use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; use function class_exists; use function sprintf; @@ -358,11 +359,17 @@ protected function ormLoad(array $config, ContainerBuilder $container) $config['entity_managers'] = $this->fixManagersAutoMappings($config['entity_managers'], $container->getParameter('kernel.bundles')); + $loadPropertyInfoExtractor = interface_exists(PropertyInfoExtractorInterface::class) + && class_exists(DoctrineExtractor::class); + foreach ($config['entity_managers'] as $name => $entityManager) { $entityManager['name'] = $name; $this->loadOrmEntityManager($entityManager, $container); - $this->loadPropertyInfoExtractor($name, $container); + if ($loadPropertyInfoExtractor) { + $this->loadPropertyInfoExtractor($name, $container); + } + $this->loadValidatorLoader($name, $container); }