title: How to implement intersect in doctrine dql
body: <p>I'm looking for a way to implement the intersect function sql into doctrine dql to use it for some queries. Here is the query i would like to intersect their result :</p>
  
  <pre><code>$sql1 = "SELECT distinct o1 FROM  Application\Entity\Object1 o1 INNER JOIN Application\Entity\Object2 o2 WITH o2.fkObject1 = o1.pkObject1  WHERE o1.etat = 'valide' AND o2.pkObject2 = $id ";
  
  $sql2 = "SELECT distinct o1 FROM  Application\Entity\Object1 o1 INNER JOIN Application\Entity\Object2 o2 WITH o2.fkObject1 = o1.pkObject1  WHERE o1.etat = 'attente' AND o2.pkObject2 = $id_2 ";
  
  $sql = "sql1 INTERSECT $sql2 ";
  </code></pre>
  
  <p><strong>// returns [Syntax Error] line 0, col 556: Error: Expected end of string, got 'INTERSECT'</strong></p>
  
  <pre><code>$query = $this-&gt;getEntityManager()-&gt;createQuery($sql);
  $results = $query-&gt;getResult();
  </code></pre>
  
  <p>Thanks.</p>