Skip to content

Commit

Permalink
Run CacheSchemaSubscriberPass after CacheCollectorPass
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sstok committed Jun 11, 2020
1 parent ffea292 commit 34e8ceb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DoctrineBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Tests/CacheSchemaSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34e8ceb

Please sign in to comment.