title: Symfony 2.7 return object Twig
body: <p>I'm trying to validate by symfony,
  the validate with Entity of symfony.
  on RegisterAction , route /regiter
  ....</p>
  
  <pre><code>  $errors = $request-&gt;getSession()-&gt;getFlashBag()-&gt;get('errors'); 
      return array(
          'title' =&gt; $title , 
          'user' =&gt; $user , 
          'login' =&gt; $login , 
          'home_categories' =&gt; $home_categories ,
          'categories' =&gt; $categories , 
          'posts' =&gt; $posts , 
          'cities' =&gt; $cities ,
          'areas' =&gt; $area , 
          'year' =&gt; $year,
          'month' =&gt; $month,
          'day' =&gt; $day,
          'errors' =&gt; $errors
        );
  </code></pre>
  
  <p>on register post check</p>
  
  <pre><code>$user = New User;
  $validator = $this-&gt;get('validator');
  $errors = $validator-&gt;validate($user);
  if (count($errors) &gt; 0)
  {
      $request-&gt;getSession()-&gt;getFlashBag()-&gt;add('errors', $errors);
      return $this-&gt;redirect($this-&gt;generateUrl('register'));
  }
  </code></pre>
  
  <hr>
  
  <p>on the twig:</p>
  
  <pre><code>{% for error in errors %} &lt;li&gt;{{ error.message }}&lt;/li&gt; {% endfor %}
  </code></pre>
  
  <p>but i get this message:</p>
  
  <blockquote>
    <p>Method "message" for object
    "Symfony\Component\Validator\ConstraintViolationList" does not exist
    in src/AppBundle/Resources/views/Default/Register.html.twig at line
    187`</p>
  </blockquote>
  
  <p>The version is Symfony 2.7. </p>
  
  <p>Thanks</p>