title: symfony2 Doctrine delete an array of objects
body: <p>I would like to delete all the records from database matching a particular user_id in Symfony2. </p>
  
  <pre><code>$em = $this-&gt;getDoctrine()-&gt;getManager();
  $user_service = $em-&gt;getRepository('ProjectTestBundle:UserService')
  -&gt;findByUser($this-&gt;getUser()-&gt;getId());
  </code></pre>
  
  <p>This might return a few matching objects, so when I run:</p>
  
  <pre><code>$em-&gt;remove($user_service);
  $em-&gt;flush();
  </code></pre>
  
  <p>an error occurs:</p>
  
  <pre><code>EntityManager#remove() expects parameter 1 to be an entity object, array given.
  </code></pre>
  
  <p>How do I remove all records (objects) matching a particular condition? 
  Btw, when I run an equivalent sql statement in mysql, it works perfectly.</p>