title: Doctrine: Filter multiple objects on start/end date
body: <p>I've got this entity which represents the hire-period of a object. On the current overview page i display all objects which can be hired at this moment. Each products has many ObjectProductPeriods</p>
  
  <pre><code>class ObjectProductPeriod
  {
  /**
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   * @ORM\Column(type="integer")
   */
  private $id;
  
  /**
   * @ORM\Column(type="date")
   */
  private $datumUit;
  
  /**
   * @ORM\Column(type="date")
   */
  private $datumTerug;
  
  /**
   * @ORM\ManyToOne(targetEntity="App\Entity\ObjectProduct", inversedBy="orderPeriods")
   */
  private $objectProduct;
  
  /**
   * @ORM\OneToOne(targetEntity="App\Entity\KlantOrder", inversedBy="objectPeriod")
   */
      private $klantOrder;
  }
  </code></pre>
  
  <p>I'm retrieving the availible objects in the ObjectProductPeriodRepository:</p>
  
  <pre><code>public function getAvailibleObjects(){
          $currentDate = new \DateTime('now');
          $query = $this-&gt;createQueryBuilder('qb')
              -&gt;where(':current NOT BETWEEN qb.datumUit AND qb.datumTerug')
              -&gt;setParameter('current', $currentDate)
              -&gt;getQuery();
          $result =$query-&gt;execute();
          $objects = array();
          foreach ($result as $key =&gt; $period){
              $objects[] = $period-&gt;getObjectProduct();
  
          }
          return $objects;
      }
  </code></pre>
  
  <p>The only issue is, that when a object has multiple periods. When the current date isn't between the start date and end end date it gets added to the objects displayed on the page. But if there's a period that's below both start and end period of that object, the whole object get's between other available objects (while it shouldn't be listed there). The overview should display objects where the current date isn't between the start and end date of any period for that particular object. So if there would be 2 Periods, one where the current date is between the first period and the second period the current date isn't between the period, in this scenario none of the objects should get displayed.</p>
  
  <p>How can i use query builder to filter objects in this particular scenario?</p>
  
  <p>Thanks in advance!</p>