doctrine / DoctrineORMModule

Doctrine ORM Module for Laminas
https://www.doctrine-project.org/projects/doctrine-orm-module.html
MIT License
437 stars 229 forks source link

Error Cache instance with Laminas Di #742

Closed wilmeryarkan closed 10 months ago

wilmeryarkan commented 1 year ago

I am updating my slides project and their respective libraries, one of them is Slides DI, which is generating a kind of conflict with Slides Cache instance (Memory).

Uncaught Laminas\Di\Exception\MissingPropertyException: Could not resolve value for parameter "storage" of type Laminas\Cache\Storage\StorageInterface in class DoctrineModule\Cache\LaminasStorageCache (requested as DoctrineModule\Cache\LaminasStorageCache) in /apps/events/vendor/laminas/laminas-di/src/Resolver/DependencyResolver.php

The error occurs when trying to instantiate by container LaminasStorageCache in CacheFactory class, and DI looks for its respective parameter in the constructor, and it can't resolve it correctly unless it is defined by Di configuration.

DoctrineModule\Service\CacheFactory.php image

Di config: image

The problem with this solution that is not flexible when change other type of cache (redis, memcached, etc).

Have any type of consideration to work with Laminas\Di of maybe have a best solution for this problem?

Thanks.

TomHAnderson commented 1 year ago

Is your problem a DI issue? Can this be solved using a factory?

TomHAnderson commented 10 months ago

Closing as cache has moved to DoctrineModule and been revamped with 6.x