Description
Description
In the cache and lock components, we have adapter classes that are able to operate on PDO and DBAL connections:
Symfony\Component\Cache\Adapter\PdoAdapter
Symfony\Component\Lock\Store\PdoStore
Symfony\Component\Lock\Store\PostgreSqlStore
This made sense in the past because DBAL implemented PDO interfaces and remained mostly compatible. However, DBAL has moved away from extending PDO and provides its own interfaces now. And it will probably deprecate more PDO-like methods in the future. Because of that, we have to bloat those classes with if/else blocks.
Would it make sense to split the DBAL logik off those adapters? For instance, we would split PdoAdapter
into PdoAdapter
and DbalAdapter
, maybe with an internal DatabaseAdapterTrait
that contains common SQL generation logic. I would expect that in the long run, those classes become more maintainable that way.