I see that the Twig_Loader_String class has been deprecated and will be removed in Twig 2.0. Also, the comments in the source indicate that it should \"NEVE
The best is: http://twig.sensiolabs.org/doc/2.x/recipes.html#loading-a-template-from-a-string
As example used by me:
public function parse($content, $maxLoops = 3, $context = array())
{
if (strlen($content) < 1) {
return null;
}
for ($i = 0; $i < $maxLoops; $i++) {
$template = $this->container->get('twig')->createTemplate($content);
$result = $template->render( $context );
if ($result == $content) {
break;
} else {
$content = $result;
}
}
return $content;
}