doctrine / DoctrineMongoODMModule

Laminas Module for Doctrine MongoDB ODM
https://www.doctrine-project.org/projects/doctrine-mongo-odm-module.html
MIT License
83 stars 87 forks source link

Avoid using deprecated methods #280

Closed rieschl closed 1 year ago

rieschl commented 1 year ago

MongoDB ODM 2.2 deprecated Doctrine\ODM\MongoDB\Configuration::getMetadataCacheImpl() and Doctrine\ODM\MongoDB\Configuration::setMetadataCacheImpl() in favor of Configuration::getMetadataCache and Configuration::setMetadataCache(), respectively, which use a PSR-6 compliant cache instead of doctrine/cache.

I refrained from allowing to pass a PSR-6 CacheItemPoolInterface directly for now, because it's currently unlikely that a cache pulled from doctrine.cache.[name] service key will return a PSR-6 cache. Such a change would probably also require changes in doctrine-module and doctrine-orm-module. But if you want me to implement that forward compatibility layer right away it's also ok for me.

fixes #279

rieschl commented 1 year ago

@driehle any feedback? Thanks 🙂

driehle commented 1 year ago

Try pulling doctrinemodule.cache.[name] instead. DoctrineModule v6 already has a compatibility layer using laminas-cache instances and doctrine.cache.[name] just a wrapper around that for doctrine/cache backward compatibility.

As I am writing this, I remember that there was some issue with the new method signatures of Doctrine's core classes. Could it be that CacheItemPoolInterface is not provided by the Laminas package?