Krzysztof Płonka Magento front-end
Temat: [SF2] Obsługa formularza w Symfony 2
Próbuję dołączyć form_widget ale wyskakuje: An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Argument 1 passed to Symfony\Bridge\Twig\Extension\FormExtension::setTheme() must be an instance of Symfony\Component\Form\FormView, null given, called in C:\xampp\htdocs\miblog-symfony-demo\app\cache\prod\twig\4f\80\29bc590343503f42640624a2600e.php on line 23 and defined in C:\xampp\htdocs\miblog-symfony-demo\vendor\symfony\src\Symfony\Bridge\Twig\Extension\FormExtension.php line 56") in AdminBundle:Comments:new.html.twig at line 2.new.html.twig
{% form_theme form 'AdminBundle:Form:fields.html.twig' %}
{% block contenido %}
<form action="{{path('admin_comment_new') }}" method="post" novalidate >
{{ form_widget(form.age) }}
<div class="form-actions">
<input class="btn btn-primary" type="submit" value="Komentuj"/>
</div>
</form>
{% endblock %}
plik fields.html.twig
{% extends 'form_div_layout.html.twig' %}
{% block integer_widget %}
<div class="integer_widget">
{% set type = type|default('number') %}
{{ block('field_widget') }}
</div>
{% endblock %}