title: Symfony2 Doctrine2 Many To Many Form not Saving Entities
body: <p>I am having some trouble with a many to many relationship. I have <code>Users</code> and <code>Assets</code>. I would like to be able to assign users to an asset on the asset page.</p>
  
  <p>The code below displays a list of users when creating/editing an asset, however changes made to the user checkboxes do not save, while the rest of the data is persisted.</p>
  
  <p>If I add an entry to users_assets through the mysql client, these changes are shown in the asset list.</p>
  
  <p><strong>User</strong></p>
  
  <pre><code>class User extends BaseUser
  {
      /**
       * @ORM\ManyToMany(targetEntity="Asset", inversedBy="users")
       */
      private $assets;
  }
  </code></pre>
  
  <p><strong>Asset</strong></p>
  
  <pre><code>class Asset
  {
      /**
       * @ORM\ManyToMany(targetEntity="User", mappedBy="assets")
       */
      private $users;
  }
  </code></pre>
  
  <p><strong>AssetType</strong></p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $form = $builder
          -&gt;add('users', null, array(
              'expanded' =&gt; true,
              'multiple' =&gt; true
          ))
          -&gt;getForm();
  
      return $form;
  }
  </code></pre>