Skip to content
Advertisement

getContainer in symfony

I am trying to get a block from a twig template them render it to my index template:

JavaScript

then get it to my controller using

JavaScript

then use it in my index template

JavaScript

but then im having a problem and symfony says

JavaScript

I dont know what to use to get the container running.

Advertisement

Answer

There is no getContainer() method for a controller.

You could access it by $this->container directly like $this->container->get('twig')

But Symfony provide shortcut method for controller, you could use $this->get('twig') too.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement