Roave / psr-container-doctrine

Doctrine Factories for PSR-11 Containers
BSD 2-Clause "Simplified" License
95 stars 31 forks source link

Added support for `DoctrineProvider` (cache). #58

Closed Moln closed 2 years ago

Moln commented 2 years ago

Added support for DoctrineProvider (cache). Factory doctrine/cache from psr/cache.

// config.php

return [
  'doctrine' => [
    'cache' => [
       'psrcache' => [
           'class' => DoctrineProvider::class,
           'instance' => CacheItemPoolInterface::class,  // PSR cache service name.
           'namespace' => 'psr-container-doctrine',
        ],
    ],
  ].
];
boesing commented 2 years ago

Since doctrine/cache is going to be removed/abandoned, we should not add further code to this component regarding doctrine/cache. In #63 I've implemented proper support for PSR-6 caches and thus, you can instead provide PSR-6 caches via PSR-11 container rather than having some config-driven handling.

TBH: I am not 100% sure on how doctrine will provide config-driven PSR-6 caches with the next major but I guess we'll see when it comes to v4 of doctrine/dbal or v3 of doctrine/orm.

Ocramius commented 2 years ago

IMO good with @boesing's suggestion: let's not add further ways to configure the cache, at this point.

Ocramius commented 2 years ago

@Moln also, really sorry for the delayed feedback: thank you for your work on this, but I hope you understand it's just for the better to mark this as wontfix.