title: How to use 'interval' in Doctrine2 Query Builder
body: <p>In my Symfony2 repository, I'd like to get objects from a schedule table, that have started, but not finished yet. The interval, within the objects should be encountered as 'not finished', should be passed as a variable.</p>
  
  <p>Using plain SQL, it works like this:</p>
  
  <pre><code>SELECT * FROM slots rbs 
    WHERE rbs.rundate = '2012-08-13' 
    AND rbs.runtime &lt;= '11:05:00' 
    AND '11:05:00' &lt;= rbs.runtime + interval '300 seconds'
    ORDER BY rbs.rundate DESC, rbs.runtime DESC
  </code></pre>
  
  <p>Can I achieve the same with DQL / Query Builder?</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>$qb = $this-&gt;createQueryBuilder('rbs');
  $qb-&gt;where(
      $qb-&gt;expr()-&gt;andX(
           $qb-&gt;expr()-&gt;eq('rbs.rundate', ':date'),
           $qb-&gt;expr()-&gt;lte('rbs.runtime', ':time'),
           'rbs.runtime + interval 300 seconds &gt;= :time'
          )
      )
    -&gt;orderBy('rbs.rundate', 'DESC')
    -&gt;addOrderBy('rbs.runtime', 'DESC')
    -&gt;setParameter('date', date('Y-m-d'))
    -&gt;setParameter('time', date('H:i:s'))
  </code></pre>
  
  <p>But this returns the following error:</p>
  
  <pre><code>[Doctrine\ORM\Query\QueryException]                                                 
  [Syntax Error] line 0, col 139: Error: Expected =, &lt;, &lt;=, &lt;&gt;, &gt;, &gt;=, !=, got '300'
  </code></pre>
  
  <p>I found that <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/dql-doctrine-query-language.html#dql-functions" rel="noreferrer">'interval' is not supported</a> by Doctrine2 / DQL, which is also mentioned <a href="https://stackoverflow.com/questions/10041513/interval-1-month-not-working-with-symfony2-doctrine">here</a>.</p>
  
  <p>Any suggestions on how to accomplish this with Doctrine2's Query Builder or DQL (and passing the interval as variable)?</p>