title: Error: Invalid PathExpression. Must be a StateFieldPathExpression.
body: <p>I'm working on a <strong>symfony project entity with query builder</strong>. When I try to run this function I get this issue.</p>
  
  <blockquote>
    <p>[Semantical Error] line 0, col 9 near 'category FROM': Error: Invalid PathExpression. Must be a StateFieldPathExpression. </p>
  </blockquote>
  
  <pre><code>public function json_filterAllproductsAction() {
  
      $search = "";
      $category = 1;
  
      //Combine tables and create the query with querybuilder
      $em = $this-&gt;container-&gt;get('doctrine.orm.entity_manager');
  
      $qb = $em-&gt;createQueryBuilder();
  
      $qb-&gt;select('p.category')
              -&gt;from('EagleAdminBundle:Products', 'p')
              -&gt;orderBy('p.id', 'DESC');
      if ($category != 0) {
          $qb-&gt;andWhere('p.category = :category')
                  -&gt;setParameter('category', $category);
      }
      $qb-&gt;andWhere('p.productTitle LIKE :title')
              -&gt;setParameter('title', "$search%");
  
      //convert to json using "JMSSerializerBundle"
      $serializer = $this-&gt;container-&gt;get('serializer');
      $jsonproducts = $serializer-&gt;serialize($qb-&gt;getQuery()-&gt;getResult(), 'json');
      return new Response($jsonproducts);
  }
  </code></pre>
  
  <p>I think error is in,</p>
  
  <blockquote>
    <p>$qb->select('p.category')</p>
  </blockquote>
  
  <p>It would be great help someone can help me. </p>