Skip to content

Prototype scope on "factory" definitions #164

@avant1

Description

@avant1

Hello.
In my app I use constructor injection, and I define it using \DI\ContainerBuilder::addDefinitions() method.
One of injected objects is injected as a factory, and this object is randomly configured in factory.
But when I get this object in constructors, the object is always same. Usually it is ok, but I would like to disable this behavior for single definition.

There is method \DI\Container::make(), but I don't know how to use it without passing container object to constructors where my randomly object needed.

Maybe there is any way to disable caching for single definition, or use make() instead of get() when constructor dependencies are created? Or should I refactor my application anyway?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions