Skip to content

Cannot modify container when locked #118

@fredw

Description

@fredw

Hi,

I have a problem/doubt about locked container, I don't understand the functioning of this issue.
I'm trying to set after call a get and an exception is thrown:

Fatal error: Uncaught exception 'Aura\Di\Exception\ContainerLocked' with message 'Cannot modify container when locked.' 

I'm trying to do something like this:

$container = (new Aura\Di\ContainerBuilder)->newInstance();

$container->set('object1', new stdClass);
var_dump($container->isLocked());
$container->get('object1');
var_dump($container->isLocked());
$container->set('object3', new stdClass); // Exception thrown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions