Reputation: 51
I use csa_guzzle_bundle with symfony 4, i have 2 clients in csa_guzzle.yaml for the moment, but it is possible that there are more in the future.
So, i want to call dynamically an csa_guzzle_client with the container $this->get("csa_guzzle.clients.".$client");
it's work in symfony 3 but not in symfony 4 because autowiring.
my question is why to add service in container_bag for use with $this->get('alias');
?
thanks for help
Upvotes: 2
Views: 135
Reputation: 51
Thank Thomas Lefetz, If you use any services no public with methode ->get(''). Inherit your controller from Symfony\Bundle\FrameworkBundle\Controller\Controller, no AbstractController.
Upvotes: 1