title: Using Query Builder in Symfony 2
body: <p>I am trying to use Query Builder in Symfony2 to get some records from a database. I run the normal query in SQL and it returns the correct results. The query is </p>
  
  <pre><code>SELECT pg.name, pg.description
  FROM pm_patentgroups pg
  LEFT JOIN pm_portfolios pp ON pp.id = pg.portfolio_id
  </code></pre>
  
  <p>I want to use the exact query using Doctorine query builder in Symfony2. What I have tried so far is </p>
  
  <pre><code> $repository = $this-&gt;getDoctrine()
          -&gt;getRepository('MunichInnovationGroupBundle:PmPatentgroups');
          $query = $repository-&gt;createQueryBuilder('pg')
          -&gt;from('pm_patentgroups', 'pg')
          -&gt;leftJoin('pg','pm_portfolios','pp','pp.id = pg.portfolio_id')
          -&gt;getQuery();
          $portfolio_groups = $query-&gt;getResult();
  </code></pre>
  
  <p>but its giving me the following error:</p>
  
  <blockquote>
    <p>Warning: Missing argument 1 for Doctrine\ORM\EntityRepository::createQueryBuilder()</p>
  </blockquote>
  
  <p>I am new to Symfony2 and Doctorine. Can you please tell me what is going wrong here?</p>
  
  <p>Thanks</p>