title: convert a sql to Doctrine query with union
body: <p>Hi i am developing a symfony2 app and having issue with UNION as symfony2 doesnt support it and i can not use pdo statements to keep the entity in query. here is my working sql:</p>
  
  <pre><code>select ca.name, count(ca.name) as total
  from content as co
  inner join category as ca
  on co.category_id=ca.id
  where ca.id in (11,7,16,1,12,13)
  group by ca.name
  union
  select 'Rest', count(ca.name) as total
  from content as co
  inner join category as ca
  on co.category_id=ca.id
  where ca.id not in (11,7,16,1,12,13);
  </code></pre>
  
  <p>the result is</p>
  
  <pre><code>"Audio Song",208
  "Drama Serial",137
  "Movie,824
  "Movie Video Song",773
  "Music Video",1225
  "Single Drama",571
  "Rest",900
  </code></pre>
  
  <p>now with symfony i am having problem with getting this Rest: here is my effort:</p>
  
  <pre><code>$query = $this-&gt;getEntityManager()
          -&gt;createQueryBuilder()
          -&gt;from('BbdBongoAppBundle:Category','cat')
          -&gt;select('cat.name AS name')
          -&gt;addSelect('(SELECT COUNT(c.id) FROM MyAppBundle:Content c WHERE c.category = cat.id) AS total')            
          -&gt;where('cat.id IN (:id)')      
          -&gt;setParameter('id', array(11,7,16,1,12,13))            
          -&gt;getQuery();
  </code></pre>
  
  <p>how can i get the Rest from my query?</p>