I'm creating a form and passing the FormView
to the template
$form = $this->createForm('my_user_form', $user);
die(get_class($form->createView()));
return $this->render('MyBundle::edit.html.twig', array(
'form', $form->createView()
));
The die()
gives me
Symfony\Component\Form\FormView
The dump()
(from the template)
{{ dump(form) }}
gives me
null
How can this be explained ?
答案 0 :(得分:0)
Thx again to @OIS, I was meaning
return $this->render('MyBundle::edit.html.twig', array(
'form' => $form->createView()
));
instead of
return $this->render('MyBundle::edit.html.twig', array(
'form', $form->createView()
));