title: symfony - querybuilder in controller
body: <p>I am using the querybuilder in my controller to receive data and output as json:</p>
  
  <pre><code>    $qb = $this-&gt;getDoctrine()-&gt;getManager();
  
      $qb = $qb-&gt;createQueryBuilder();
  
      $qb-&gt;select('c')
          -&gt;from('AppBundle:Customer\Customer', 'c');
  
      $data = $qb-&gt;getQuery()-&gt;getResult();
  
      $response = new JsonResponse();
      $response-&gt;setData(
          [
              'data' =&gt; $data
          ]
      );
  
      return $response;
  </code></pre>
  
  <p>My Entity is in namespace:</p>
  
  <pre><code>namespace AppBundle\Entity\Customer;
  
  use Doctrine\ORM\Mapping as ORM;
  use Doctrine\Common\Collections\ArrayCollection;
  use Symfony\Component\Validator\Constraints as Assert;
  
  
  /**
   * @ORM\Table(name="customer")
   * @ORM\Entity(repositoryClass="AppBundle\Entity\Customer\Repository")
   */
  class Customer {
  
  ....
  </code></pre>
  
  <p>There are two records saved in table.</p>
  
  <p>When I load the url it just print two empty array´s and no data.</p>
  
  <p>Anybody could explain why?</p>