Closed
Description
Symfony version(s) affected
>=5.4
Description
According to the docs it should be possible to use DSN to configure the PDOAdapter, how an exception is thrown instead:
Unsupported DSN: it does not start with "redis[s]:", "memcached:" nor "couchbase:".
This happens because the AbstractAdapter::createConnection()
supports only certain adapters:
symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
Lines 127 to 144 in 58353d1
I'm not sure if this is a bug in the documentation (and possible new feature) or a bug in the code.
How to reproduce
framework:
cache:
pools:
my.cache:
adapter: cache.adapter.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: 'my.cache')] private CacheInterface $cache,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
return Command::SUCCESS;
}
}
Possible Solution
Add the necessary logic to AbstractAdapter::createConnection()
.
Additional Context
No response