title: Expected argument of type array or Traversable and ArrayAccess, object given
body: <p>I have a problem with my form,i have this error every time i want to save a comment : </p>
  
  <blockquote>
    <p>Expected argument of type array or Traversable and ArrayAccess, object given </p>
  </blockquote>
  
  <p>firstly i create my class commentType : </p>
  
  <pre><code>    public function buildForm(FormBuilder $builder, array $options)
  {
      $builder
          -&gt;add('comment', 'textarea')
          -&gt;add('commentedName', 'text')
          -&gt;add('idNews','hidden',  array('error_bubbling'=&gt;true))
          -&gt;add('country', 'text')
          -&gt;add('email','email')
          -&gt;add('captcha', 'captcha');
  }
  </code></pre>
  
  <p>I customise my form :</p>
  
  <pre><code>   public function getDefaultOptions(array $options){
  
  $collectionConstraint = new Collection (array (
      'email' =&gt; new Email(array('message' =&gt; 'invalid address email')),
      'commentedName' =&gt; array(new MaxLength(array('limit' =&gt; 30, 'message' =&gt; ''))),
      'comment' =&gt; array(new MinLength(array('limit' =&gt; 20, 'message' =&gt; ''))),
      'country' =&gt; new MinLength(array('limit' =&gt; 3, 'message' =&gt; '')),
      'idNews' =&gt; array(new MaxLength(array('limit' =&gt; 30, 'message' =&gt; ''))),
  ));
  
  return array('validation_constraint' =&gt; $collectionConstraint);
  }
  </code></pre>
  
  <p>then in my controller i call my form and i save data in DB :</p>
  
  <pre><code>$comment =  new \Mybundle\BackendBundle\Entity\Comments();
  
  $form = $this-&gt;createForm(new \Mybundle\MainBundle\Form\CommentType(), $comment);
  
      $request = $this-&gt;get('request');
  if ($request-&gt;getMethod() == 'POST') {
      $form-&gt;bindRequest($request);
  
      if ($form-&gt;isValid()) {
          $idNews= $this-&gt;getDoctrine()
              -&gt;getRepository('Mybundle\BackendBundle\Entity\News')
              -&gt;find($id);
  
          $comment-&gt;setIdNews($idNews);
  
          $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
          $em-&gt;persist($comment);
          $em-&gt;flush();
  
         return $this-&gt;redirect($this-&gt;generateUrl('News',array('id' =&gt; $id,'slug'=&gt;$slug)));
  </code></pre>
  
  <p>and in my twig i do : </p>
  
  <pre><code>&lt;table style="float: right;" &gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;{{ form_widget(form.commentedName) }} &lt;/td&gt;
          &lt;td&gt;{{ form_label(form.commentedName, "name") }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="comment-error"&gt;{{ form_errors(form.commentedName) }}&lt;/TD&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;{{ form_widget(form.country) }} &lt;/td&gt;
          &lt;td&gt;{{ form_label(form.country, "country") }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="comment-error"&gt;{{ form_errors(form.country) }}&lt;/TD&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="large_text"&gt;{{ form_widget(form.email) }} &lt;/td&gt;
          &lt;td&gt;{{ form_label(form.email, "address") }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="comment-error"&gt;{{ form_errors(form.email) }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;{{ form_widget(form.comment) }} &lt;/td&gt;
          &lt;td&gt;{{ form_label(form.comment, "comment") }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="comment-error"&gt;{{ form_errors(form.comment) }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;{{ form_widget(form.captcha) }} &lt;/td&gt;
      &lt;/tr&gt;
  
   &lt;tr&gt;
          &lt;td class="comment-error"&gt;{{ form_errors(form) }}&lt;/td&gt;
      &lt;/tr&gt;  
  </code></pre>
  
  <p>
  </p>
  
  <p>I remark when i change in my cotroller the object "$comment" with "null" in the line above i didn't have the error but i can"t save data in database...</p>
  
  <p>Anyone have an idea?</p>