Symfony 4. How to access the service from controller without dependency injection?
问题 I have several services: DieselCaseService, CarloanCaseService LvCaseService. The controller decides which of services to get. $type = $quickCheck["type"]; /** * @var $caseService \App\Service\Cases\CaseInterface */ $type = 'diesel; // for test purposes $caseService = $this->get('case_service.' . $type); The service aliases are declared like this: case_service.diesel: alias: App\Service\Cases\DieselCaseService public: true class DieselCaseService implements CaseInterface { . . . } If I try to