-
-
Notifications
You must be signed in to change notification settings - Fork 324
Prototype scope on "factory" definitions #164
Copy link
Copy link
Closed
Labels
Milestone
Description
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?
Reactions are currently unavailable