The most efficient way that I found to get the number of errors in the form does not matter form_bubbling true or false is to add some variable to the controller that points to this:
return $this->render('Acme:Contrats:index.html.twig', array( 'myform' => $form->createView(), 'myformHasErrors' => !$form->isValid(), ));
If someone finds another, comment / reply to this.
Clement herreman
source share