title: Symfony save multiple entities
body: <p>I have a form with multi-select dropdown list. Faced a problem with its saving.
  There are 3 enitities: Client, Client Tag, Tag.</p>
  
  <p>Part of Client Tag entity:</p>
  
  <pre><code>    /**
   * @ORM\Column(
   *     type="date",
   *     nullable=true
   * )
   * @JMS\Groups({"list", "single"})
   *
   * @var \DateTime
   */
  protected $dateExpiry;
  
  /**
   * @ORM\ManyToOne(targetEntity="Client")
   * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
   * @JMS\Groups("list")
   *
   * @var Client
   */
  protected $client;
  
  /**
   * @ORM\ManyToOne(targetEntity="Tag")
   * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
   * @JMS\Groups({"list", "single"})
   *
   * @var Tag
   */
  protected $tag;
  </code></pre>
  
  <p>Then I have a form on Client Tag</p>
  
  <pre><code>    /**
   * @param FormBuilderInterface $builder
   * @param array                $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('client')
          -&gt;add('tag')
          -&gt;add('dateExpiry', DateTimeType::class, array(
              'widget' =&gt; 'single_text',
              'format' =&gt; 'yyyy-MM-dd', ))
      ;
  }
  </code></pre>
  
  <p>With single select dropdown list I was sending values like:</p>
  
  <pre><code>{tag: 1, client: 1, dateExpire: 2000-10-10}
  </code></pre>
  
  <p>And it worked fine.</p>
  
  <p>Now when I switched to multiselect dropdown it is not working anymore, so Im sending data like:</p>
  
  <pre><code>{tag: [1, 2], client: 1, dateExpire: 2000-10-10}
  </code></pre>
  
  <p>Error <em>"tag:["This value is not valid."]"</em>.</p>
  
  <p>I already spend many hours with this problem, please help.</p>
  
  <p>UPD:
  Im rendering the form like:</p>
  
  <pre><code>{% verbatim %}
  
      &lt;md-input-container &gt;
          &lt;label&gt;Tag&lt;/label&gt;
          &lt;md-content &gt;
              &lt;md-select multiple class="select-position"  required ng-model="formData.tags"  placeholder="Select a tag"&gt;
                  &lt;md-option ng-value="tag.id" ng-repeat="tag in allTags"&gt;{{ tag.name }}
                  &lt;/md-option&gt;
              &lt;/md-select&gt;
          &lt;/md-content&gt;
      &lt;/md-input-container&gt;
  
      &lt;mdp-date-picker mdp-placeholder="Expire date" mdp-min-date="minTagExpireDate"
                       mdp-format="YYYY-MM-DD" ng-model="formData.dateExpiry"&gt;&lt;/mdp-date-picker&gt;
  
      &lt;div data-ng-messages="errors" role="alert" data-ng-show="form.$submitted"&gt;
          &lt;div data-ng-message="tag" class="autocomplete-error"&gt;Tag not found.&lt;/div&gt;
      &lt;/div&gt;
  
  {% endverbatim %}
  </code></pre>
  
  <p>And sending it like (part of code):</p>
  
  <pre><code>                formVm.customData = angular.copy(formVm.formData);
                  formVm.customData.client = clientId;
                  formVm.customData.dateExpiry = $filter('date')(formVm.customData.dateExpiry, 'yyyy-MM-dd');
                  return $http.post(router.generate('api_client_tag_create'), formVm.customData);
  </code></pre>