title: Doctrine2: [Semantical Error] Cannot select entity through identification variables without choosing at least one root entity alias
body: <p>This is my query with query builder, and it works perfectly, bringing all the results of user table and the modules table, which has a many to many association:</p>
  
  <pre><code>public function getUser($id){
      $qb = $this-&gt;getEm()-&gt;createQueryBuilder()
      -&gt;select('u', 'm')
      -&gt;from('Adm\Entity\User', 'u')
      -&gt;join('u.modules', 'm')
      -&gt;where('u.id = ?1')
      -&gt;setParameters(array(1 =&gt; $id));
      $result = $qb-&gt;getQuery()-&gt;getResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
      return $result;
  }
  </code></pre>
  
  <p>But when i try to select specific fields from user like this:</p>
  
  <pre><code>public function getUser($id){
      $qb = $this-&gt;getEm()-&gt;createQueryBuilder()
      -&gt;select('u.id, u.name, u.email', 'm')
      -&gt;from('Adm\Entity\User', 'u')
      -&gt;join('u.modules', 'm')
      -&gt;where('u.id = ?1')
      -&gt;setParameters(array(1 =&gt; $id));
      $result = $qb-&gt;getQuery()-&gt;getResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
      return $result;
  }
  </code></pre>
  
  <p>Doctrine throws an error:</p>
  
  <pre><code>[Semantical Error] line 0, col -1 near 'SELECT u.id,': Error: Cannot select entity through identification variables without choosing at least one root entity alias.
  </code></pre>
  
  <p>I would like to know how to do that, to select specific fields from the entity and not all the fields.</p>