-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected
7.1.0, 7.2.0 BETA
Description
Currently it seems to be not possible to use the cache.app.taggable service as adapter for cache pools.
Uncaught Exception: Service ".cache.object.inner": The argument "1" doesn't exist in class "Symfony\Component\Cache\Adapter\TagAwareAdapter".
This is especially relevant since with #57927 using cache.app adapter together with tagsconfig option would lead to an deprecation since 7.2.0.
The issue seems to be that in https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php#L114 the namespace and defaultLifetime configs options are passed to the adapter by replacing the arguments.
This assumes that the implementations support that, however in the case of the cache.app.taggable that service is no adapter directly that supports setting those args, but it is a TagAwareAdapter that only "wraps" the cache.app service: https://github.com/symfony/symfony/blob/7.2/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.php#L40
How to reproduce
framework:
cache:
pools:
cache.object:
default_lifetime: 172800
adapter: cache.app.taggable
tags: cache.tags
cache.tags:
adapter: cache.appNote
When you omit the default_lifetime setting you get a slightly different error, but still it won't work
framework:
cache:
pools:
cache.object:
adapter: cache.app.taggable
tags: cache.tags
cache.tags:
adapter: cache.appwill lead to
Uncaught Error: Symfony\Component\Cache\Adapter\TagAwareAdapter::__construct(): Argument #1 ($itemsPool) must be of type Symfony\Component\Cache\Adapter\AdapterInterface, string given
Possible Solution
Easiest would be to revert #57927 so that we could use cache.app adapter as before, as that actually worked.
The proper solution would be to apply the pool configs (defaultLifetime + namespace) to the actual adapter and not to the TagAware adapter wrapper
Additional Context
No response