From 34e8ceb051934c0c95a4163b28c1216f2764b1f4 Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Mon, 8 Jun 2020 09:18:09 +0200 Subject: [PATCH] Run CacheSchemaSubscriberPass after CacheCollectorPass The `CacheCollectorPass` of the Cache component decorates the cache adapters with a `TracingAdapter` which breaks the expectation that the provided Adapter provided to the `CacheSchemaSubscriber` is a `PdoAdapter` with the `configureSchema` method. By running the `CacheSchemaSubscriberPass` after the `CacheCollectorPass` only the actual Adapters (not decorated one) are correctly provided. --- DoctrineBundle.php | 2 +- Tests/CacheSchemaSubscriberTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DoctrineBundle.php b/DoctrineBundle.php index f0ac519de..96503354e 100644 --- a/DoctrineBundle.php +++ b/DoctrineBundle.php @@ -41,7 +41,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new ServiceRepositoryCompilerPass()); $container->addCompilerPass(new WellKnownSchemaFilterPass()); $container->addCompilerPass(new DbalSchemaFilterPass()); - $container->addCompilerPass(new CacheSchemaSubscriberPass(), PassConfig::TYPE_OPTIMIZE, -10); + $container->addCompilerPass(new CacheSchemaSubscriberPass(), PassConfig::TYPE_BEFORE_REMOVING, -10); } /** diff --git a/Tests/CacheSchemaSubscriberTest.php b/Tests/CacheSchemaSubscriberTest.php index d056d21fd..9d7248a0d 100644 --- a/Tests/CacheSchemaSubscriberTest.php +++ b/Tests/CacheSchemaSubscriberTest.php @@ -65,7 +65,7 @@ public function testSchemaSubscriberWiring() : void $container->register('uses_my_cache_adapter', 'stdClass') ->addArgument(new Reference('my_cache_adapter')) ->setPublic(true); - $container->addCompilerPass(new CacheSchemaSubscriberPass(), PassConfig::TYPE_OPTIMIZE, -10); + $container->addCompilerPass(new CacheSchemaSubscriberPass(), PassConfig::TYPE_BEFORE_REMOVING, -10); $container->compile(); // check that PdoAdapter service is injected as an argument