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

[Cache/DI] Can not autowire TagAwareAdapterInterface #52703

Closed
KDederichs opened this issue Nov 23, 2023 · 1 comment
Closed

[Cache/DI] Can not autowire TagAwareAdapterInterface #52703

KDederichs opened this issue Nov 23, 2023 · 1 comment

Comments

@KDederichs
Copy link
Contributor

Symfony version(s) affected

6.4.0-RC1

Description

When trying to inject a RedisTagAwareAdapter via TagAwareAdapterInterface will throw an error:

Cannot autowire service "App\Service\Price\PriceService": argument "$priceCachePool" of method "__construct()" references interface "Symfony\Component\Cache\Adapter\TagAwareAdapterInterface" but no such service exists. Try changing the type-hint to "Psr\Cache\CacheItemPoolInterface" instead.

According to https://symfony.com/doc/current/cache.html this should work.

How to reproduce

Cache Pool Configuration:

            price_cache_pool:
                adapter: cache.adapter.redis_tag_aware
                provider: snc_redis.price_cache
                tags: true

(Also doesn't work when tags are missing)

DI Part:

readonly class PriceService
{
    public function __construct(
        private TagAwareAdapterInterface $priceCachePool,
    ) {}

Possible Solution

No response

Additional Context

No response

@KDederichs
Copy link
Contributor Author

Never mind, Contract and Contacts....

@derrabus derrabus closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants