Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone example in README.md does not work #285

Open
boesing opened this issue Jan 17, 2024 · 1 comment
Open

Standalone example in README.md does not work #285

boesing opened this issue Jan 17, 2024 · 1 comment
Labels
Bug Something isn't working Documentation Help Wanted

Comments

@boesing
Copy link
Member

boesing commented Jan 17, 2024

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.

@boesing boesing added Bug Something isn't working Documentation labels Jan 17, 2024
@froschdesign
Copy link
Member

The example should be removed from the readme file. Instead some links to the documentation should be added:

  • Introduction
  • Installation
  • Quick Start / Basic Usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Documentation Help Wanted
Projects
None yet
Development

No branches or pull requests

2 participants