Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle][Cache] The cache.[type] services are never created #52461

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

Closed
HypeMC opened this issue Nov 5, 2023 · 2 comments
Closed

[FrameworkBundle][Cache] The cache.[type] services are never created #52461

HypeMC opened this issue Nov 5, 2023 · 2 comments

Comments

@HypeMC
Copy link
Contributor

HypeMC commented Nov 5, 2023

Symfony version(s) affected

>=5.4

Description

According to the docs:

Some of these adapters could be configured via shortcuts. Using these shortcuts will create pools with service IDs that follow the pattern cache.[type].

This is however not true, the services are not created and after checking the original PR I can confirm that this never worked as described. As a matter of fact, I not convinced this was ever meant to work as described. I believe this is a bug in the docs, but since I'm not 100% sure, I was hoping to get some feedback first.

How to reproduce

framework:
    cache:
        default_pdo_provider: 'pgsql:host=localhost;port=5432;dbname=postgres;user=postgres;password=pass'
#[AsCommand('app:test')]
class TestCommand extends Command
{
    public function __construct(
        #[Autowire(service: 'cache.pdo')] private CacheInterface $cache,
    ) {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        return Command::SUCCESS;
    }
}
  The service "App\Command\TestCommand" has a dependency on a non-existent service "cache.pdo".
  Did you mean this: "cache.app"?

Possible Solution

No response

Additional Context

No response

@nicolas-grekas
Copy link
Member

The doc is wrong indeed, we don't create such services. There are only two concrete services by default: cache.app and cache.service (well, add cache.validator and a a few others for mostly internal need).

The backend-specific adapters are abstract are named cache.adapter.foo.

@HypeMC
Copy link
Contributor Author

HypeMC commented Nov 6, 2023

Thanks, I'll open a PR in the docs repo.

@HypeMC HypeMC closed this as completed Nov 6, 2023
OskarStark added a commit to symfony/symfony-docs that referenced this issue Nov 7, 2023
…eMC)

This PR was merged into the 5.4 branch.

Discussion
----------

[Cache] Remove invalid info about cache pool services

As discussed in symfony/symfony#52461 the `cache.[type]` services are never created nor meant to be created.

This PR removes any reference to them.

Commits
-------

9af5aee [Cache] Remove invalid info about cache pool services
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

3 participants