I have symfony project and inside this project, I have big own service which is huge and complicated with own dependencies etc... And I wanna create facade for this service with purpose to use my service in controllers
like:
$myService = $this->container->get('service_from_my_domain');
My question - is how inside my facade I can get access to container
to service's dependencies. I know only 1 way - is to inject dependency into service in yaml config.
But is there another way to do it? Like:
$dependency = Container::getInstance()->get('my_dependency_service');
I've found this answer but using global variable feels like back in time...
PS: I don't want to inject dependency through yaml config (constructor injection not setter injection) because I don't need IoC (inversion-of-control) here.
Aucun commentaire:
Enregistrer un commentaire