title: Symfony 2 Catchable Fatal Error: Object of class UserCategory could not be converted to string
body: <p>I try to put in place a system of categories . I love that my users can tag with categories . So I put a Array Collection and a " ManyToMany " but it does not work and whatever I do I get this error " Catchable Fatal Error : Object of class Shootngo \ CoreBundle \ Entity \ UserCategory couldn't be converted to string".</p>
  
  <p>If someone could help me, i think i will not have hairs if i continue to search a solution...</p>
  
  <pre><code>           $userCategories = new ArrayCollection();
  
          foreach ($form-&gt;getCategories()-&gt;getLibCategory() as $category) {
              $userCategories-&gt;add($category);
          }
  
          $user-&gt;addCategory($userCategories);
  </code></pre>
  
  <p>My FormType :</p>
  
  <pre><code>            -&gt;add('category', CollectionType::class, array(
              'entry_type' =&gt; UserCategoryType::class,
              'allow_add'    =&gt; true,
          ))
  </code></pre>
  
  <p>My View :</p>
  
  <pre><code>&lt;div class="form-group"&gt;
     &lt;label class="col-sm-4 control-label"&gt;Catégories&lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt;
      &lt;div class="col-sm-6"&gt;
        {{ form_errors(form.category) }}
        &lt;ul id="category-list" data-prototype="{{ form_widget(form.category.vars.prototype)|e }}"&gt;
          {% for cat in form.category %}
             {{ form_errors(cat) }}
             &lt;div class="form-group"&gt;
                {{ form_widget(cat,{'attr' : {'class' : 'form-control', 'placeholder' : "", 'data-parsley-required' : 'data-parsley-required'}}) }}
             &lt;/div&gt;
          {% endfor %}
        &lt;/ul&gt;
        &lt;a href="#" id="add-another-category"&gt;Add another category&lt;/a&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>thank in advance ! 
  Christophe</p>