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のように呼んでいます:デフォルト:アクション –