Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cache overrides new definitions #222

@mnapoli

Description

@mnapoli

If we use a cache:

My\Interface::class => DI\object(MyClass1::class)
        ->scope(DI\Scope::PROTOTYPE()),

If we get the entry, then override the definition, for example:

$this->container->set('My\Interface', \DI\object('ADifferentClass')
    ->scope(\DI\Scope::PROTOTYPE()));

Then the cached definition is not cleared and the new definition is ignored.

At first thought, DefinitionManager::addDefinition() should be fixed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions