2

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

2
  • Your controller has to herit from Symfony\Bundle\FrameworkBundle\Controller\Controller, not from AbstractController Commented Nov 20, 2018 at 9:31
  • thank you for help!, it's work! Commented Nov 23, 2018 at 12:43

1 Answer 1

1

Thank Thomas Lefetz, If you use any services no public with methode ->get(''). Inherit your controller from Symfony\Bundle\FrameworkBundle\Controller\Controller, no AbstractController.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.