title: Symfony entity field : manyToMany with multiple = false - field not populated correctly
body: <p>I am using symfony2 with doctrine 2.
  I have a many to many relationship between two entities :</p>
  
  <pre><code>/**
   * @ORM\ManyToMany(targetEntity="\AppBundle\Entity\Social\PostCategory", inversedBy="posts")
   * @ORM\JoinTable(
   *     name="post_postcategory",
   *     joinColumns={@ORM\JoinColumn(name="postId", referencedColumnName="id", onDelete="CASCADE")},
   *     inverseJoinColumns={@ORM\JoinColumn(name="postCategoryId", referencedColumnName="id", onDelete="CASCADE")}
   * )
   */
  private $postCategories;
  </code></pre>
  
  <p>Now I want to let the user only select one category. For this I use the option 'multiple' => false in my form.</p>
  
  <p>My form:</p>
  
  <pre><code>        -&gt;add('postCategories', 'entity', array(
                  'label'=&gt; 'Catégorie',
                  'required' =&gt; true,
                  'empty_data' =&gt; false,
                  'empty_value' =&gt; 'Sélectionnez une catégorie',
                  'class' =&gt; 'AppBundle\Entity\Social\PostCategory',
                  'multiple' =&gt; false,
                  'by_reference' =&gt; false,
                  'query_builder' =&gt; $queryBuilder,
                  'position' =&gt; array('before' =&gt; 'name'),
                  'attr' =&gt; array(
                      'data-toggle'=&gt;"tooltip",
                      'data-placement'=&gt;"top",
                      'title'=&gt;"Choisissez la catégorie dans laquelle publier le feedback",
                  )))
  </code></pre>
  
  <p>This first gave me errors when saving and I had to change the setter as following :</p>
  
  <pre><code>/**
   * @param \AppBundle\Entity\Social\PostCategory $postCategories
   *
   * @return Post
   */
  public function setPostCategories($postCategories)
  {
      if (is_array($postCategories) || $postCategories instanceof Collection)
      {
          /** @var PostCategory $postCategory */
          foreach ($postCategories as $postCategory)
          {
              $this-&gt;addPostCategory($postCategory);
          }
      }
      else
      {
          $this-&gt;addPostCategory($postCategories);
      }
  
      return $this;
  }
  
  /**
   * Add postCategory
   *
   * @param \AppBundle\Entity\Social\PostCategory $postCategory
   *
   * @return Post
   */
  public function addPostCategory(\AppBundle\Entity\Social\PostCategory $postCategory)
  {
      $postCategory-&gt;addPost($this);
      $this-&gt;postCategories[] = $postCategory;
  
      return $this;
  }
  
  /**
   * Remove postCategory
   *
   * @param \AppBundle\Entity\Social\PostCategory $postCategory
   */
  public function removePostCategory(\AppBundle\Entity\Social\PostCategory $postCategory)
  {
      $this-&gt;postCategories-&gt;removeElement($postCategory);
  }
  
  /**
   * Get postCategories
   *
   * @return \Doctrine\Common\Collections\Collection
   */
  public function getPostCategories()
  {
      return $this-&gt;postCategories;
  }
  /**
   * Constructor
   * @param null $user
   */
  public function __construct($user = null)
  {
      $this-&gt;postCategories = new \Doctrine\Common\Collections\ArrayCollection();
  }
  </code></pre>
  
  <p>Now, when editing a post, I also have an issue because it uses a getter which ouputs a collection, not a single entity, and my category field is not filled correctly. </p>
  
  <pre><code>/**
   * Get postCategories
   *
   * @return \Doctrine\Common\Collections\Collection
   */
  public function getPostCategories()
  {
      return $this-&gt;postCategories;
  }
  </code></pre>
  
  <p>It's working if I set 'multiple' => true but I don't want this, I want the user to only select one category and I don't want to only constraint this with asserts.</p>
  
  <p>Of course there are cases when I want to let the user select many fields so I want to keep the manyToMany relationship.</p>
  
  <p>What can I do ?</p>