title: Symfony2 - Doctrine2 QueryBuilder WHERE IN ManyToMany field
body: <p>:)</p>
  
  <p>Thank you in advance for helping me with this issue:</p>
  
  <p>I've an entity Hotel which has a ManyToMany relation with an entity HotelService</p>
  
  <p>how can i build (with QueryBuilder if possible) one query to select all hotels having a subset of services given as array parameter?</p>
  
  <p>Example: H1(S1, S2, S3, S4), H2(S2, S3, S4), H3(S1, S2, S3)</p>
  
  <p>Querying with subset (S1, S2) has to return H1 and H3.</p>
  
  <p>I have tried many things, this is some code extract:</p>
  
  <pre><code>public function findByServices($services) {
   
      $qb = $this-&gt;createQueryBuilder('hotel')
   
              -&gt;addSelect('location')
   
              -&gt;addSelect('country')
   
              -&gt;addSelect('billing')
   
              -&gt;addSelect('services')
   
              -&gt;innerJoin('hotel.billing', 'billing')
   
              -&gt;innerJoin('hotel.location', 'location')
   
              -&gt;innerJoin('location.city', 'city')
   
              -&gt;innerJoin('location.country', 'country');
   
              -&gt;innerJoin('hotel.services', 'services');
   
      $i = 0;
      $arrayIds = array();
      foreach ($services as $service) {
          $arrayIds[$i++] = $service-&gt;getId();
      }
      $qb-&gt;add('where', $qb-&gt;expr()-&gt;in('services', $arrayIds))-&gt;getQuery();
  }
  </code></pre>
  
  <p>This code return all hotels for which there is ONE service id in $arrayIds.</p>
  
  <p>I want the opposite (hotels for which services contain ALL ids in $arrayIds).</p>
  
  <p>Of course, inversing parameters in expr()->in doesn't solve the problem, and create bad parameters errors.</p>
  
  <p>Can somebody help me please? (sorry for my bad english) :)</p>