title: Doctrine 2 DQL - nest expressions and functions in the QueryBuilder
body: <p>I have found <a href="https://github.com/beberlei/DoctrineExtensions" rel="nofollow">DoctrineExtensions</a> module that has implement some useful MySQL functions. But I think my problem is a general one. How would you pass another mysql expression as a parameter into a function?</p>
  
  <p>If I had 2 columns <code>updated_at</code> which is a <code>DATETIME</code> and <code>lifespan</code> which is an <code>INT</code> and I wanted to query whether the lifetime of an entity had expired, I could do this;</p>
  
  <pre><code>WHERE 0 &gt; TIMESTAMPDIFF(SECONDS, NOW(), e.updated_at + INTERVAL e.lifespan SECOND)
  </code></pre>
  
  <p>IN the QueryBuilder it's something like this.</p>
  
  <pre><code>$qb-&gt;andWhere('0 &gt; TIMESTAMPDIFF(SECONDS, CURRENT_TIMESTAMP(), e.updated_at + INTERVAL e.lifespan SECOND)');
  </code></pre>
  
  <p>But the parser doesn't like <code>+ INTERVAL e.lifespan SECOND</code> because it expects the Close Parenthesis instead of a plus sign.</p>