我在我的 Twig 模板中这样调用渲染(第 18 行)
{{ render(controller('AcmeReadingBundle:Default:newAction')) }}
控制器是
public function newAction(Request $request)
{
$message = new Message();
$form = $this->createFormBuilder($message)
->add('body', 'text')
->add('save', 'submit')
->getForm();
$form->handleRequest($request);
return $this->render('AcmeReadingBundle:Default:new.html.twig', array(
'form' => $form->createView(),
));
}
而 new.html.twig 文件是
{{ form(form) }}
我不断收到此错误:
An exception has been thrown during the rendering of a template ("The controller for URI "/_fragment" is not callable.") in AcmeReadingBundle:Default:show.html.twig at line 18.