As the error message said, there is no renderView
method in the TwigEngine
. renderView()
is a shortcut in the symfony base controller class:
namespace Symfony\Bundle\FrameworkBundle\Controller
class Controller extends ContainerAware
{
/**
* Returns a rendered view.
*
* @param string $view The view name
* @param array $parameters An array of parameters to pass to the view
*
* @return string The rendered view
*/
public function renderView($view, array $parameters = array())
{
return $this->container->get('templating')->render($view, $parameters);
}
}
There you can see the correct method to render a view with the templating
service.
$this->container->get('templating')->render(
'BatchingBundle:Default:email.html.twig', array('content' => $content)
)