Reputation: 6016
I have created a form in symfony2:
$form = $this->createFormBuilder()
->add('name', 'text')
->getForm();
return $this->render('SixStringPearBundle:Icon:form.html.twig', array("form" => $form->createView()));
When i go to render: {{ form(form) }}
I get the following error:
The function "form" does not exist. Did you mean "form_row", "form_rest", "form_label", "form_errors", "form_widget", "form_enctype" in SixStringPearBundle:Icon:form.html.twig at line 1
I have also tried using:
{{ form_start(form) }}
{{ form_errors(form) }}
{{ form_row(form.name) }}
<input type="submit" />
{{ form_end(form) }}
And I get the following error:
The function "form_start" does not exist in SixStringPearBundle:Icon:form.html.twig at line 1
Any thoughts as to why this may be happening?
Upvotes: 0
Views: 3073
Reputation: 6016
The function was changed from form_widget() to form()
in symfony2.3. I am using symfony2.2 and was reading the wrong docs
Upvotes: 1
Reputation: 48865
Which version of S2 are you using? Did you change anything in app/config/config.yml?
I suspect that maybe you had a typo somewhere and kept having issues trying to fix it. Reduce your form.html.twig file to just one line:
{{ form(form) }}
Unless you somehow managed to disable the twig bridge FormExtension then it should see the form function.
==================
@cheesemacfly is correct. form() was added to 2.3. When looking at the documentation, select the correct version in the upper right hand corner. Better yet, start over with S2.3.0. No point in working with older versions.
Upvotes: 0