title: Form rendering for many to many relation in symfony 4 does not work
body: <p>I have many to many relation between two entities Recipient and Recipient Group. I am trying to setup a form for Recipient where I must be able to add multiple Recipient Group to Recipient. But when I try to run the rendered form, I get the following error even though addXXX and removeXXX methods exist in both the classes.</p>
  
  <pre><code>Could not determine access type for property "recipientGroups" in class 
  "App\Entity\Recipient": The property "recipientGroups" in class "App\Entity\Recipient" can 
  be defined with the methods "addRecipientGroup()", "removeRecipientGroup()" but the new 
  value must be an array or an instance of \Traversable, "App\Entity\RecipientGroup" given.
  </code></pre>
  
  <p>Entity/Recipient</p>
  
  <pre><code>**
   * 
  @ORM\Entity(repositoryClass="App\Repository\RecipientRepository")
  */
  class Recipient
  {
      ...
  
      /**
       * @ORM\ManyToMany(targetEntity="App\Entity\RecipientGroup", inversedBy="recipients")
       */
      private $recipientGroups;
  
      public function __construct()
      {
           $this-&gt;recipientGroups = new ArrayCollection();
      }
  
      /**
       * @return Collection|RecipientGroup[]
       */
      public function getRecipientGroups(): Collection
      {
          return $this-&gt;recipientGroups;
      }
  
      public function addRecipientGroup(RecipientGroup $recipientGroup): self
      {
          if (!$this-&gt;recipientGroups-&gt;contains($recipientGroup)) {
              $this-&gt;recipientGroups[] = $recipientGroup;
              $recipientGroup-&gt;addRecipient($this);
          }
          return $this;
       }
  
       public function removeRecipientGroup(RecipientGroup $recipientGroup): self
       {
          if ($this-&gt;recipientGroups-&gt;contains($recipientGroup)) {
          $this-&gt;recipientGroups-&gt;removeElement($recipientGroup);
          $recipientGroup-&gt;removeRecipient($this);
       }
  
       return $this;
      }
  
      public function getCreatedAt(): DateTime
      {
          return $this-&gt;createdAt;
      }
  
      public function setCreatedAt(DateTime $createdAt): self
      {
          $this-&gt;createdAt = $createdAt;
  
          return $this;
      }
  
      public function getUpdatedAt(): DateTime
      {
          return $this-&gt;updatedAt;
      }
  
      public function setUpdatedAt(DateTime $updatedAt): self
      {
          $this-&gt;updatedAt = $updatedAt;
  
          return $this;
      }
  }
  </code></pre>
  
  <p>Entity/RecipientGroup:</p>
  
  <pre><code>/**
   * @ORM\Entity(repositoryClass="App\Repository\RecipientGroupRepository")
   */
  class RecipientGroup  
  {
  
      /**
       * @ORM\ManyToMany(targetEntity="App\Entity\Recipient", mappedBy="recipientGroups")
       */
      private $recipients;
  
      public function __construct()
      {
          $this-&gt;recipients = new ArrayCollection();
      }
  
       * @return Collection|Recipient[]
       */
      public function getRecipients(): Collection
      {
          return $this-&gt;recipients;
      }
  
      public function addRecipient(Recipient $recipient): self
      {
          if (!$this-&gt;recipients-&gt;contains($recipient)) {
              $this-&gt;recipients[] = $recipient;
              $recipient-&gt;addRecipientGroup($this);
          }
  
          return $this;
      }
  
      public function removeRecipient(Recipient $recipient): self
      {
          if ($this-&gt;recipients-&gt;contains($recipient)) {
               $this-&gt;recipients-&gt;removeElement($recipient);
               $recipient-&gt;removeRecipientGroup($this);
           }
  
           return $this;
       }
    }
  </code></pre>
  
  <p>form/RecipientType</p>
  
  <pre><code>class RecipientType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('fullName')
              -&gt;add('email')
              -&gt;add('recipientGroups', CollectionType::class, [
                  'entry_type' =&gt; RecipientGroupBlockType::class,
                  'entry_options' =&gt; ['label' =&gt; false],
                  'allow_add' =&gt; true,
                  'allow_delete' =&gt; true,
                  'help' =&gt; '&lt;a data-collection="add" class="btn btn-info btn-sm" href="#"&gt;Add Recipient Group&lt;/a&gt;',
                  'help_html' =&gt; true,
                  'by_reference' =&gt; false,
              ]);
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; Recipient::class,
          ]);
      }
  </code></pre>
  
  <p>}</p>
  
  <p>form/RecipientGroupBlockType:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Form;
  
  use App\Entity\Recipient;
  use App\Entity\RecipientGroup;
  use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class RecipientGroupBlockType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('recipientGroups', EntityType::class,[
                  'class' =&gt; RecipientGroup::class,
                  'choice_label' =&gt; 'title',
                  'placeholder' =&gt; 'Select an option'
              ]);
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; Recipient::class,
          ]);
      }
  }
  </code></pre>