From 45d4f6a6e91c9774b45889c0fad6b60c6441e22f Mon Sep 17 00:00:00 2001 From: Artem Lopata Date: Wed, 8 Dec 2021 12:13:24 +0100 Subject: [PATCH] CacheCompatibilityPass will also take care of FileLockRegion. --- DependencyInjection/Compiler/CacheCompatibilityPass.php | 5 +++++ .../Compiler/CacheCompatibilityPassTest.php | 1 + 2 files changed, 6 insertions(+) diff --git a/DependencyInjection/Compiler/CacheCompatibilityPass.php b/DependencyInjection/Compiler/CacheCompatibilityPass.php index 5574048ba..0d3f587b4 100644 --- a/DependencyInjection/Compiler/CacheCompatibilityPass.php +++ b/DependencyInjection/Compiler/CacheCompatibilityPass.php @@ -67,6 +67,11 @@ private function updateSecondLevelCache(ContainerBuilder $container, Definition $regionDefinition = $container->getDefinition($factoryMethodCall[1][0]); + // Get inner service for FileLock + if ($regionDefinition->getClass() === '%doctrine.orm.second_level_cache.filelock_region.class%') { + $regionDefinition = $container->getDefinition($regionDefinition->getArgument(0)); + } + // We don't know how to adjust custom region classes if ($regionDefinition->getClass() !== '%doctrine.orm.second_level_cache.default_region.class%') { continue; diff --git a/Tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php b/Tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php index ede60f565..db06c4014 100644 --- a/Tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php +++ b/Tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php @@ -52,6 +52,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void 'second_level_cache' => [ 'enabled' => true, 'regions' => [ + 'filelock' => ['type' => 'filelock', 'lifetime' => 0, 'cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool']], 'lifelong' => ['lifetime' => 0, 'cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool']], 'entity_cache_region' => ['type' => 'service', 'service' => $this->regionClass], ],