Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache compatibility with cache pools #1360

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

ostrolucky
Copy link
Member

@ostrolucky ostrolucky commented Jun 1, 2021

Somehow I cannot trigger the issue via a test, help welcome there.

@nicolas-grekas
Copy link
Member

I confirm this fixes the issue.

@StaffNowa
Copy link

StaffNowa commented Jun 1, 2021

I had the same issue :) Now works again :)

@ostrolucky
Copy link
Member Author

@nicolas-grekas can you help with a test case? I wonder why this doesn't trigger the issue

public function testCacheConfigUsingCachePools(): void
{
    $this->expectNotToPerformAssertions();
    (new class () extends TestKernel {
        public function registerContainerConfiguration(LoaderInterface $loader): void
        {
            parent::registerContainerConfiguration($loader);
            $loader->load(static function (ContainerBuilder $containerBuilder): void {
                $containerBuilder->loadFromExtension('framework', [
                    'cache' => [
                        'pools' => [
                            'doctrine.result_cache_pool' => ['adapter' => 'cache.app'],
                            'doctrine.system_cache_pool' => ['adapter' => 'cache.system'],
                        ],
                    ],
                ]);
                $containerBuilder->loadFromExtension(
                    'doctrine',
                    ['orm' => [
                        'query_cache_driver' => ['type' => 'service', 'id' => 'custom_cache_service'],
                        'result_cache_driver' => ['type' => 'pool', 'id' => 'doctrine.result_cache_pool'],
                    ]]
                );
                $containerBuilder->setDefinition(
                    'custom_cache_service',
                    (new Definition(DoctrineProvider::class))
                        ->setArguments([new Definition(ArrayAdapter::class)])
                        ->setFactory([DoctrineProvider::class, 'wrap'])
                );
            });
        }
    })->boot();
}

@dmaicher
Copy link
Contributor

dmaicher commented Jun 1, 2021

@ostrolucky this reproduces it for me

    public function testCacheConfigUsingCachePools(): void
    {
        (new class () extends TestKernel {
            public function registerContainerConfiguration(LoaderInterface $loader): void
            {
                parent::registerContainerConfiguration($loader);
                $loader->load(static function (ContainerBuilder $containerBuilder): void {
                    $containerBuilder->loadFromExtension('framework', [
                        'cache' => [
                            'pools' => [
                                'doctrine.result_cache_pool' => ['adapter' => 'cache.adapter.filesystem'],
                            ],
                        ],
                    ]);
                    $containerBuilder->loadFromExtension(
                        'doctrine',
                        ['orm' => [
                            'result_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.result_cache_pool'],
                        ]]
                    );
                });
            }
        })->boot();
    }
- 'result_cache_driver' => ['type' => 'pool', 'id' => 'doctrine.result_cache_pool'],
+ 'result_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.result_cache_pool'],

@ostrolucky ostrolucky force-pushed the fix-cache-pools-compatibility branch from 511418f to 9cc34c6 Compare June 1, 2021 18:08
@ostrolucky
Copy link
Member Author

Thanks @dmaicher, I'm tired today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants