我打电话渲染像这样在我的树枝模板(第18行)Symfony的控制器使嵌入错误:控制器URI“/ _fragment”不是调用
{{ 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.
我试过用这段代码和即时获得相同的结果 –
对不起,应该是新的,而不是newAction – nifr
我的控制器被称为newAction,如在代码示例。我称它为AcmeReadingBundle:默认:动作 –