symfony 3.4 form.vars.errors, , error_bubbling = true form compound = false, .
:
{% set errors = false %}
{% for child in form.children %}
{% if child.vars.errors is defined and child.vars.errors|length %}
{% set errors = true %}
{% endif %}
{% endfor %}
{% if errors %}
[...]
{% endif %}
AuthenticationUtils, :
if ($error = $authenticationUtils->getLastAuthenticationError()) {
$form->get('mail')->addError(new FormError($error->getMessageKey()));
}
if ($lastUsername = $authenticationUtils->getLastUsername()) {
$form->get('mail')->setData($lastUsername);
}
return $this->render('@ExampleBundle/template.html.twig', array('form' => $form->createView(), 'error' => $error));
, :
{% if error %}
[...]
{% endif %}