I have this code inside a regular symfony2 controller:
$temp = $this->render('BizTVArchiveBundle:ContentTemplate:'.$content[$i]['template'].'/view.html.twig', array( 'c'=> $content[$i], 'ordernumber' => 1, ));
And it works great.
Now I'm trying to port this to a service, but I don't know how to access the $ equivalent of this normal controller.
I tried to enter the container as follows:
$systemContainer = $this->container; $temp = $systemContainer->render('BizTVArchiveBundle:ContentTemplate:'.$content[$i]['template'].'/view.html.twig', array( 'c'=> $content[$i], 'ordernumber' => 1, ));
But this did not work, and I assume that this is because the render does not actually use the $ this-> regular controller container, but only uses $ this part.
Does anyone know how to use $ this-> render () from a service?
source share