title: Doctrine2 - Multiple insert in one shot
body: <p>I'm new to Doctrine and there are still some blurred areas for me. In this case I'm inserting new record in the database using a loop and the entity manager. It works fine but I noticed that Doctrine make one insert query by entity, which can become pretty huge.</p>
  
  <p>Using Doctrine2 and Symfony 2.3, I would like to know how we can set it up so it would make only 1 insert query with all the values in it (we are talking of 1 entity only of course).</p>
  
  <p>What I mean is changing this :</p>
  
  <pre><code>INSERT INTO dummy_table VALUES (x1, y1)    
  INSERT INTO dummy_table VALUES (x2, y2)
  </code></pre>
  
  <p>Into</p>
  
  <pre><code>INSERT INTO dummy_table VALUES (x1, y1), (x2, y2)
  </code></pre>
  
  <p>Here is my code :</p>
  
  <pre><code>$em = $this-&gt;container-&gt;get('doctrine')-&gt;getManager();
  
  foreach($items as $item){
      $newItem = new Product($item['datas']);
      $em-&gt;persist($newItem);
  }
  
  $em-&gt;flush();
  </code></pre>