Skip to content

Standalone example in README.md does not work #285

Open
@boesing

Description

Bug Report

Q A
Version(s) * since it was added

Summary

The README.md example does not work due to the lack of the ConfigProvider of the memory adapter being passed to the ConfigAggregator.

Current behavior

Execution will fail, Memory adapter is not retrievable.

How to reproduce

use Laminas\Cache\ConfigProvider;
use Laminas\Cache\Service\StorageAdapterFactoryInterface;
use Laminas\Cache\Storage\Adapter\Memory;
use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ServiceManager\ServiceManager;

$config = (new ConfigAggregator([
    ConfigProvider::class,
]))->getMergedConfig();

$dependencies = $config['dependencies'];

$container = new ServiceManager($dependencies);

/** @var StorageAdapterFactoryInterface $storageFactory */
$storageFactory = $container->get(StorageAdapterFactoryInterface::class);

$storage = $storageFactory->create(Memory::class); // ServiceNotFoundException

Expected behavior

$storage variable contains an instance of the Memory adapter.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions