title: Query builder: multiple AND act like an OR
body: <p>I have a many to many relation between  entities Content and Filter.
  I would like to get all Contents which have the filters "1", "2" AND "3" (all three). My query gives me results as if I would use "OR, because I get a lot of contents which have only one of the three Filter.</p>
  
  <p>My query:</p>
  
  <pre><code>public function getContentByFilters($categ, $filter, $filter2, $filter3){
      $query = $this-&gt;createQueryBuilder('c')
      -&gt;leftJoin('c.filterfilter', 'f')
      -&gt;where('f.idfilter = :filter_idfilter')
      -&gt;setParameter('filter_idfilter', $filter)
      -&gt;andWhere('f.idfilter = :filter_idfilter')
      -&gt;setParameter('filter_idfilter', $filter2)
      -&gt;andWhere('f.idfilter = :filter_idfilter')
      -&gt;setParameter('filter_idfilter', $filter3)
      -&gt;andWhere('c.contentCategorycontentCategory = ?2')
      -&gt;setParameter(2, $categ)
      -&gt;getQuery()-&gt;getResult();
  
      return $query;
  }
  </code></pre>
  
  <p>Entity Content:</p>
  
  <pre><code>/**
   * Content
   *
   * * @ORM\Entity(repositoryClass="loic\ContentBundle\Entity\ContentRepository")
   * @ORM\Table(name="content", uniqueConstraints={@ORM\UniqueConstraint(name="idcontent_UNIQUE", columns={"idcontent"})}, indexes={@ORM\Index(name="user_id", columns={"user_id"}), @ORM\Index(name="fk_content_content_category1_idx", columns={"content_category_idcontent_category"})})
   */
  class Content
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="idcontent", type="integer", nullable=false)
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="IDENTITY")
       */
      private $idcontent;
  
  .............
  /**
   * @var \Doctrine\Common\Collections\Collection
   *
   * @ORM\ManyToMany(targetEntity="loic\FilterBundle\Entity\Filter", inversedBy="contentcontent")
   * @ORM\JoinTable(name="content_has_filter",
   *   joinColumns={
   *     @ORM\JoinColumn(name="content_idcontent", referencedColumnName="idcontent")
   *   },
   *   inverseJoinColumns={
   *     @ORM\JoinColumn(name="filter_idfilter", referencedColumnName="idfilter")
   *   }
   * )
   */
  private $filterfilter;
  
  /**
   * Constructor
   */
  public function __construct()
  {
      $this-&gt;contentLinked = new \Doctrine\Common\Collections\ArrayCollection();
      $this-&gt;filterfilter = new \Doctrine\Common\Collections\ArrayCollection();
      $this-&gt;creationDate = new \DateTime();
  }
  
  .........
  
  /**
   *
   * @return the \Doctrine\Common\Collections\Collection
   */
  public function getFilterfilter() {
      return $this-&gt;filterfilter;
  }
  
  /**
   *
   * @param
   *          $filterfilter
   */
  public function setFilterfilter($filterfilter) {
      $this-&gt;filterfilter = $filterfilter;
      return $this;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Entity Filter:</p>
  
  <pre><code> use Doctrine\ORM\Mapping as ORM;
  
      /**
       * Filter
       *
       * * @ORM\Entity(repositoryClass="loic\FilterBundle\Entity\FilterRepository")
       * @ORM\Table(name="filter", uniqueConstraints={@ORM\UniqueConstraint(name="idfilter_UNIQUE", columns={"idfilter"})}, indexes={@ORM\Index(name="fk_filter_filter_category1_idx", columns={"filter_category_idfilter_category"})})
       */
      class Filter
      {
          /**
           * @var integer
           *
           * @ORM\Column(name="idfilter", type="integer", nullable=false)
           * @ORM\Id
           * @ORM\GeneratedValue(strategy="IDENTITY")
           */
          private $idfilter;
  
      ............
  
  
          /**
           * @var \Doctrine\Common\Collections\Collection
           *
           * @ORM\ManyToMany(targetEntity="loic\ContentBundle\Entity\Content", mappedBy="filterfilter")
           */
          private $contentcontent;
  
      .....
  
        /**
           * Constructor
           */
          public function __construct()
          {
              $this-&gt;contentcontent = new \Doctrine\Common\Collections\ArrayCollection();
              $this-&gt;user = new \Doctrine\Common\Collections\ArrayCollection();
              $this-&gt;status = 1;
          }
  
      ......
  
          /**
           *
           * @return the \Doctrine\Common\Collections\Collection
           */
          public function getContentcontent() {
              return $this-&gt;contentcontent;
          }
  
          /**
           *
           * @param
           *          $contentcontent
           */
          public function setContentcontent($contentcontent) {
              $this-&gt;contentcontent = $contentcontent;
              return $this;
          }
  </code></pre>