thephpleague / container

Small but powerful dependency injection container

Home Page:http://container.thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method injection

jenssegers opened this issue · comments

In the previous version there was a call method you could use to do method injection (injecting dependencies in a method call).

Eg. $container->call('someFunction');

I see that the method still exists on the ReflectionContainer. But how do you access it once you add it as a delegate to your container?

Hi, call was never actually meant for standard method injection at a class level, it used reflection to enable you to invoke a method that required dependencies as args.

I've pulled away from any reflection being enabled by default in the main container, however, ReflectionContainer::call still exists so you can use it still if you like :-)

How do you access the delegate ReflectionContainer from a container? I can't really find a way unless you would keep a reference to the actual object during initialization.