This tutorial is built on top of the course that we built during the Symfony 3 series: https://symfonycasts.com/tr.... You can download the course code from this page - we mention a few of these details during the first video - https://symfonycasts.com/sc...
Well one more service is used via the container: $transformer = $this->get('AppBundle\Service\MarkdownTransformer'); in the new genusController showAction(). So this has to be public as well.
But yea, you're right - you can't fetch a private service from the container. But instead of making it public, in that later chapter, we use special controller argument dependency injection!
Cheers!
Please, log in to vote for this comment
|
Share Comment
"Houston: no signs of life" Start the conversation!
4 Comments
Hi, from what vodeo comes app.enouraging_message_generator in services.yml & GenusAdminController, tell please.
Hey @Andrey!
This tutorial is built on top of the course that we built during the Symfony 3 series: https://symfonycasts.com/tr.... You can download the course code from this page - we mention a few of these details during the first video - https://symfonycasts.com/sc...
Cheers!
Well one more service is used via the container: $transformer = $this->get('AppBundle\Service\MarkdownTransformer');
in the new genusController showAction(). So this has to be public as well.
Yo Mike P.!
Actually, at this exact moment in the tutorial, we're still using
$this->get('app.markdown_transformer'), which inlegacy_aliases.yml(and those aliases are public). We do change to use the private, class id later - https://knpuniversity.com/screencast/symfony-3.3/controller-di-cleanup#private-services-and-container-gt-get - and we see an error and refactor to a controller argument.But yea, you're right - you can't fetch a private service from the container. But instead of making it public, in that later chapter, we use special controller argument dependency injection!
Cheers!
"Houston: no signs of life"
Start the conversation!