【发布时间】:2013-04-13 02:19:03
【问题描述】:
我的实体中有一个回调方法
@Assert\Callback(methods={"isStudentsOK"})
....
public function isStudentsOK(ExecutionContext $context)
{
if ( $this->students->isEmpty())
$context->addViolationAtSubPath('students', 'Missing students informations', array(), null);
}
我想翻译我模板中的信息。{{ form_errors(form.student)|trans }} 不起作用...
我有这个
<span class="help-inline">Missing students informations</span>
这是一个错误吗?我该怎么办?
编辑
我自己找到了回复:
我已经安装了一个 BootstrapBundle,{% block form_errors %} 显示在一个 span 内
我已经覆盖了form_div_layout.html.twig 模板。
【问题讨论】:
-
你应该写一个答案并将其标记为答案,而不是让这个问题保持打开状态。