title: Doctrine 2 select count groupBy
body: <p>I'm trying to retrieve a number of rows with unique uids.</p>
  
  <pre><code>$qb-&gt;select('COUNT() as cnt')
              -&gt;from($type, 'c')
              -&gt;groupBy('c.organization, c.process_role, c.domain, c.year')
              -&gt;getQuery()-&gt;getSingleScalarResult()
  </code></pre>
  
  <p>But it returns an array of group counts. How should I write this correct?</p>
  
  <p>Finally, that works, but it's kinda ugly</p>
  
  <pre><code>$count = $this-&gt;_em-&gt;createQuery( 'SELECT COUNT(c.id) FROM '.$type.' as c WHERE c.id IN ('
              . 'SELECT c1.id FROM ' . $type . ' c1 '
              . 'GROUP BY c1.organization, c1.process_role, c1.domain, c1.year)')
              -&gt;getSingleScalarResult();
  </code></pre>