Symfony2 サイトで次のエラーが発生するという問題が突然発生しています:
Variable "form" does not exist in SiteBackendBundle::layout.html.twig at line 2
.
私の SiteBackendBundle::layout.html.twig ファイルは次のようになります。
{% extends '::base.html.twig' %}
{% form_theme form 'SiteBackendBundle:Form:fields.html.twig' %}
{% block body %}
....
{% endblock %}
私の SiteBackendBundle:Form:fields.html.twig は次のようになります。
{% block money_widget %}
{% spaceless %}
{{ block('form_widget_simple') | raw }}
{% endspaceless %}
{% endblock %}
Symfony/forms の config.yml は次のようになります。
framework:
#esi: ~
translator: { fallback: en }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
私が走る前にこれが機能していたので、それも奇妙ですphp app/console cache:clear
このエラーが発生せずにフォームを拡張できないのはなぜですか? この正確なメソッドはhttp://symfony.com/doc/2.2/cookbook/form/form_customization.html#method-2-inside-a-separate-templateで定義されています