最近,我用作曲家更新了我的项目。 我不知道问题是在更新之后或之前创建的,但是在错误中,这是更新日志:
- Removing twig/twig (v1.14.1)
- Installing twig/twig (v1.14.2)
Downloading: 100%
- Removing symfony/symfony (v2.2.9)
- Installing symfony/symfony (v2.2.10)
Downloading: 100%
- Removing doctrine/dbal (v2.4.0)
- Installing doctrine/dbal (v2.4.1)
Downloading: 100%
- Removing doctrine/orm (v2.4.0)
- Installing doctrine/orm (v2.4.1)
Downloading: 100%
- Removing monolog/monolog (1.6.0)
- Installing monolog/monolog (1.7.0)
Downloading: 100%
- Removing jms/metadata (1.4.2)
- Installing jms/metadata (1.5.0)
Downloading: 100%
- Removing gedmo/doctrine-extensions (v2.3.7)
- Installing gedmo/doctrine-extensions (v2.3.8)
Downloading: 100%
- Updating friendsofsymfony/message-bundle dev-master (d5b40ed => 74f62b0)
Checking out 74f62b094a37bfcea96e812de0610b96ba412628
- Updating stfalcon/tinymce-bundle dev-master (4cfe656 => 3205116)
Checking out 32051165ccb6bde327ec121b3f294d807ceb427e
这是错误: 当twig模板文件使用trans扩展时,我收到错误。 例如,这个FOSUserBundle原始文件出错:
{% block fos_user_content %}
{% if error %}
<div>{{ error|trans }}</div>
{% endif %}
<form action="{{ path("fos_user_security_check") }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" />
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required" />
<input type="checkbox" id="remember_me" name="_remember_me" value="on" />
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" />
</form>
{% endblock fos_user_content %}
但这完美无缺:
{% block fos_user_content %}
{% if error %}
<div>{{ error|trans }}</div>
{% endif %}
<form action="{{ path("fos_user_security_check") }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
<label for="username">Nom d'utilisateur :</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" />
<label for="password">Mot de passe :</label>
<input type="password" id="password" name="_password" required="required" />
<input type="checkbox" id="remember_me" name="_remember_me" value="on" />
<label for="remember_me">Se souvenir de moi</label>
<input type="submit" id="_submit" name="_submit" value="connexion" />
</form>
{% endblock fos_user_content %}
但是对于绘制形式,symfony使用trans扩展,我再次出现错误,这是错误消息:
An exception has been thrown during the rendering of a template ("") in form_div_layout.html.twig at line 235.
有关信息,这是“form_div_layout.html.twig”中的第235行:
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
此错误与使用FOSUserBundle和表单呈现的登录表单相同。 我已经清除了缓存,手动删除了缓存文件夹内容,我又得到了这个错误......
有人有想法吗?