title: Doctrine: Convert a createQuery query to createQueryBuilder
body: <p>This is the current query that I have, and it works fine:</p>
  
  <pre><code>$q = $this-&gt;_em-&gt;createQuery("SELECT s FROM app\models\Sub s 
                                LEFT JOIN s.case c
                                WHERE s.type LIKE '%$type'
                                AND c.id = '$id'");
  
  
  foreach ($q-&gt;getResult() as $row) {
     $results[$row-&gt;getId()] = $row;
  }
  </code></pre>
  
  <p>I want to convert this to the QueryBuilder API structure, this is what I have so far, but it's not working correctly. (And I need the results as the same format as above).</p>
  
  <pre><code> $q = $this-&gt;_em-&gt;createQueryBuilder();
  
   $q-&gt;add('select', 's')
     -&gt;add('from', 'app\models\Sub s')
     -&gt;add('leftJoin', 's.case c')
     -&gt;add('where', 's.type LIKE :type')
     -&gt;add('where', 'c.id = :case');
     -&gt;setParameter('type', "%$type");
     -&gt;setParameter('case', $id);
  </code></pre>
  
  <p>And again, this isn't working properly, and I don't know how to get the results in the same format as above. Thanks!</p>