title: Doctrine orderBy on SUM() field with alias
body: <p>I am trying to do a simple query in doctrine but struggling. </p>
  
  <pre><code>$query-&gt;select(array(
      'app_title' =&gt; 'u.title',
      'user_name' =&gt; 'u.user_name',
      'first_used' =&gt; 'MIN(u.creation_time)',
      'last_used' =&gt; 'MAX(u.stop_time)',
      'total_usage' =&gt; 'SUM(u.stream_seconds)',
  ))
  -&gt;from(self::USAGE_TABLE, 'u')
  -&gt;orderBy('total_usage', 'DESC');
  </code></pre>
  
  <p>Obviously I get an error about the column name not being known because Doctrine is using it's own aliases (sclr4). </p>
  
  <p>However, if I try and order by the actual value; SUM(u.stream_seconds), then I get an unexpected bracket in the order by clause, I'm pretty sure SQL doesnt support this. </p>
  
  <p>So, I am simply trying to put data in a table and handle the sorting of the columns. This seems so simple, how do I do it? Any ideas?</p>