I have some services, which also have some dependencies in other services, so, I decided to inject the @service_container
in each one of these services, instead of the very specific dependencies. The result is something like this:
class InternalComponentHelper implements ContainerAwareInterface
{
use ContainerAwareTrait;
public function somefunction(){
//Do something with the container
}
}
Then in my service definition
intcomponent_helper:
class: AplicacionBaseBundle\DependencyInjection\Helpers\InternalComponentHelper
calls:
- [setContainer, ["@service_container"]]
What I need to know is if this is a bad practice and what harm or performance issue could it cause, if any. There are no circular dependencies by the way.