From 0ef81ed47bb2c155ff81774a91fdf732531d6e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20de=20Guillebon?= Date: Sun, 12 May 2019 14:47:47 +0200 Subject: [PATCH 1/6] Fix service non existent error --- DependencyInjection/DoctrineExtension.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 8c7f730d8..54838a9ba 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -739,7 +739,7 @@ protected function loadCacheDriver($driverName, $entityManagerName, array $drive break; case 'pool': - $serviceId = $this->createPoolCacheDefinition($container, $aliasId, $driverMap['pool']); + $serviceId = $this->createPoolCacheDefinition($container, $driverMap['pool']); break; case 'provider': @@ -862,7 +862,7 @@ private function loadMessengerServices(ContainerBuilder $container) : void $transportFactoryDefinition->addTag('messenger.transport_factory'); } - private function createPoolCacheDefinition(ContainerBuilder $container, string $aliasId, string $poolName) : string + private function createPoolCacheDefinition(ContainerBuilder $container, string $poolName) : string { if (! class_exists(DoctrineProvider::class)) { throw new LogicException('Using the "pool" cache type is only supported when symfony/cache is installed.'); @@ -870,7 +870,7 @@ private function createPoolCacheDefinition(ContainerBuilder $container, string $ $serviceId = sprintf('doctrine.orm.cache.pool.%s', $poolName); - $definition = $container->register($aliasId, DoctrineProvider::class); + $definition = $container->register($serviceId, DoctrineProvider::class); $definition->addArgument(new Reference($poolName)); $definition->setPrivate(true); From 4806ff119be37437d9ad101a9e20661f9fd50ab9 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 13 May 2019 10:01:39 +0100 Subject: [PATCH 2/6] fix schema filtes on doctrine/dbal >= 2.9 --- DoctrineBundle.php | 2 ++ Tests/BundleTest.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/DoctrineBundle.php b/DoctrineBundle.php index a12018df4..e8111b0a6 100644 --- a/DoctrineBundle.php +++ b/DoctrineBundle.php @@ -2,6 +2,7 @@ namespace Doctrine\Bundle\DoctrineBundle; +use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DbalSchemaFilterPass; use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\EntityListenerPass; use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass; use Doctrine\Common\Util\ClassUtils; @@ -36,6 +37,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new DoctrineValidationPass('orm')); $container->addCompilerPass(new EntityListenerPass()); $container->addCompilerPass(new ServiceRepositoryCompilerPass()); + $container->addCompilerPass(new DbalSchemaFilterPass()); } /** diff --git a/Tests/BundleTest.php b/Tests/BundleTest.php index 03fb26ec5..cb50a7403 100644 --- a/Tests/BundleTest.php +++ b/Tests/BundleTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Bundle\DoctrineBundle\Tests; +use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DbalSchemaFilterPass; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass; @@ -21,16 +22,20 @@ public function testBuildCompilerPasses() $foundEventListener = false; $foundValidation = false; + $foundSchemaFilter = false; foreach ($passes as $pass) { if ($pass instanceof RegisterEventListenersAndSubscribersPass) { $foundEventListener = true; } elseif ($pass instanceof DoctrineValidationPass) { $foundValidation = true; + } elseif ($pass instanceof DbalSchemaFilterPass) { + $foundSchemaFilter = true; } } $this->assertTrue($foundEventListener, 'RegisterEventListenersAndSubscribersPass was not found'); $this->assertTrue($foundValidation, 'DoctrineValidationPass was not found'); + $this->assertTrue($foundSchemaFilter, 'DbalSchemaFilterPass was not found'); } } From ed05135eeef3e556d788a1910bc3fe9f33bec028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 12 May 2019 22:45:17 +0200 Subject: [PATCH 3/6] Wiring of the new PropertyAccessExtractor --- DependencyInjection/DoctrineExtension.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 54838a9ba..046c10763 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\PropertyAccessExtractorInterface; use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface; use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; use function class_exists; @@ -794,6 +795,12 @@ private function loadPropertyInfoExtractor($entityManagerName, ContainerBuilder $propertyExtractorDefinition->addTag('property_info.list_extractor', ['priority' => -1001]); $propertyExtractorDefinition->addTag('property_info.type_extractor', ['priority' => -999]); + + if (! is_a(DoctrineExtractor::class, PropertyAccessExtractorInterface::class, true)) { + return; + } + + $propertyExtractorDefinition->addTag('property_info.access_extractor', ['priority' => -999]); } /** From e86af6c8e0e2660f61118c09eb3505b006dc891a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Mon, 13 May 2019 16:22:32 +0200 Subject: [PATCH 4/6] Skip generating link for backtrace record with missing file, fixes #967 --- Resources/views/Collector/db.html.twig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Resources/views/Collector/db.html.twig b/Resources/views/Collector/db.html.twig index 6d29a248f..c8ef49b89 100644 --- a/Resources/views/Collector/db.html.twig +++ b/Resources/views/Collector/db.html.twig @@ -289,10 +289,14 @@ {% set line_number = trace.line|default(1) %} - + {% if trace.file is defined %} + + {% endif %} {{- trace.class|default ~ (trace.class is defined ? trace.type|default('::')) -}} {{ trace.function }} - + {% if trace.file is defined %} + + {% endif %} (line {{ line_number }}) From 56ecbd6a9489a69f4fd438d0e074ebc9312d2b38 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 4 Jun 2019 08:29:59 +0200 Subject: [PATCH 5/6] Fix usage of wrong option in previously delegated commands Fixes an issue reported in #976, previously introduced in #892. --- Command/Proxy/CollectionRegionDoctrineCommand.php | 2 +- Command/Proxy/EntityRegionCacheDoctrineCommand.php | 2 +- Command/Proxy/QueryRegionCacheDoctrineCommand.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Command/Proxy/CollectionRegionDoctrineCommand.php b/Command/Proxy/CollectionRegionDoctrineCommand.php index d12614537..c5df01599 100644 --- a/Command/Proxy/CollectionRegionDoctrineCommand.php +++ b/Command/Proxy/CollectionRegionDoctrineCommand.php @@ -26,7 +26,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { - DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection')); + DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); return parent::execute($input, $output); } diff --git a/Command/Proxy/EntityRegionCacheDoctrineCommand.php b/Command/Proxy/EntityRegionCacheDoctrineCommand.php index 4b2d40d56..55ea3b86f 100644 --- a/Command/Proxy/EntityRegionCacheDoctrineCommand.php +++ b/Command/Proxy/EntityRegionCacheDoctrineCommand.php @@ -26,7 +26,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { - DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection')); + DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); return parent::execute($input, $output); } diff --git a/Command/Proxy/QueryRegionCacheDoctrineCommand.php b/Command/Proxy/QueryRegionCacheDoctrineCommand.php index 084841b90..b7b761bb7 100644 --- a/Command/Proxy/QueryRegionCacheDoctrineCommand.php +++ b/Command/Proxy/QueryRegionCacheDoctrineCommand.php @@ -26,7 +26,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { - DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection')); + DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); return parent::execute($input, $output); } From 043b4259841933ec36891960534ecc11e904a64d Mon Sep 17 00:00:00 2001 From: javer Date: Wed, 15 May 2019 01:19:27 +0300 Subject: [PATCH 6/6] Fix BC break with DoctrineType::reset() Fixes BC break with mistakenly removed `kernel.reset` tag from `form.type.entity` service, because `DoctrineType` implements `ResetInterface`, but this service is not autoconfigured, so the `kernel.reset` tag won't be added automatically. This BC break was introduced in version 1.11.0 in commit 6b25ea4 --- DependencyInjection/DoctrineExtension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 046c10763..daea1d7c7 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Form\AbstractType; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransportFactory; use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface; @@ -343,6 +344,10 @@ protected function ormLoad(array $config, ContainerBuilder $container) $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('orm.xml'); + if (class_exists(AbstractType::class)) { + $container->getDefinition('form.type.entity')->addTag('kernel.reset', ['method' => 'reset']); + } + $entityManagers = []; foreach (array_keys($config['entity_managers']) as $name) { $entityManagers[$name] = sprintf('doctrine.orm.%s_entity_manager', $name);