title: Rest API - Why is Postman sending me back empty curly brackets with GET
body: <p>I'm working on a REST API. Hence I created my entities like for example this one musee.php</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Musee
   *
   * @ORM\Table(name="musee")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\MuseeRepository")
   */
  class Musee
  {
  /**
   * @var int
   * @ORM\Id
   * @ORM\Column(type="integer")
   * @ORM\GeneratedValue
   */
  private $id;
  
  /**
   * @var string
   *
   * @ORM\Column(type="string", nullable=false)
   */
  private $nom;
  
  /**
   * @var string
   *
   * @ORM\Column(type="string", nullable=false)
   */
  private$adresse;
  
  /**
   * @var integer
   *
   * @ORM\Column(type="integer", nullable=false)
   */
  private $horaireOuverture;
  
  /**
   * @var integer
   *
   * @ORM\Column(type="integer", nullable=false)
   */
  private $horaireFermeture;
  
  
  /**
   * @ORM\OneToMany(targetEntity="AppBundle\Entity\Bateau", mappedBy="musee")
   * @ORM\JoinColumn(referencedColumnName="id")
   */
  private $bateaux;
  
  /**
   * @return int
   */
  public function getId()
  {
      return $this-&gt;id;
  }
  
  /**
   * @param int $id
   */
  public function setId($id)
  {
      $this-&gt;id = $id;
  }
  
  /**
   * @return string
   */
  public function getNom()
  {
      return $this-&gt;nom;
  }
  
  /**
   * @param string $nom
   */
  public function setNom($nom)
  {
      $this-&gt;nom = $nom;
  }
  
  /**
   * @return string
   */
  public function getAdresse()
  {
      return $this-&gt;adresse;
  }
  
  /**
   * @param string $adresse
   */
  public function setAdresse($adresse)
  {
      $this-&gt;adresse = $adresse;
  }
  
  /**
   * @return int
   */
  public function getHoraireOuverture()
  {
      return $this-&gt;horaireOuverture;
  }
  
  /**
   * @param int $horaireOuverture
   */
  public function setHoraireOuverture($horaireOuverture)
  {
      $this-&gt;horaireOuverture = $horaireOuverture;
  }
  
  /**
   * @return int
   */
  public function getHoraireFermeture()
  {
      return $this-&gt;horaireFermeture;
  }
  
  /**
   * @param int $horaireFermeture
   */
  public function setHoraireFermeture($horaireFermeture)
  {
      $this-&gt;horaireFermeture = $horaireFermeture;
  }
  
  /**
   * @return mixed
   */
  public function getBateaux()
  {
      return $this-&gt;bateaux;
  }
  
  /**
   * @param mixed $bateaux
   */
  public function setBateaux($bateaux)
  {
      $this-&gt;bateaux = $bateaux;
  }
  
  
  }
  </code></pre>
  
  <p>My MuseeRepository also exists and in my config.yml I put (both were installed with composer) : </p>
  
  <pre><code># Nelmio CORS
  nelmio_cors:
      defaults:
          allow_credentials: false
          allow_origin: ['*']
          allow_headers: ['Content-Type']
          allow_methods: ['POST', 'PATCH', 'GET', 'DELETE', 'OPTIONS']
          max_age: 3600
      paths:
          '^/api':
  
  # FosRest
  fos_rest:
  routing_loader:
      include_format: false
  view:
      view_response_listener: true
  format_listener:
      rules:
          - { path: '^/', priorities: ['json'], fallback_format: 'json' }
  </code></pre>
  
  <p>In my MuseeController here is what I put: </p>
  
  <pre><code>&lt;?php
  /**
   * Created by PhpStorm.
   * User: Fanny
   * Date: 28/03/2018
   * Time: 16:13
  */
  
  namespace AppBundle\Controller;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use FOS\RestBundle\Controller\Annotations as Rest;
  use FOS\RestBundle\Controller\FOSRestController;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
  use FOS\RestBundle\View\View;
  use AppBundle\Entity\Musee;
  
  class MuseeController extends Controller
  {
      /**
       * @Rest\View(serializerGroups={"musee"})
       * @Rest\Get("/musee")
      */
  
     // Fonction qui renvoie toutes all musee
      public function findMusee()
     {
          $musee = $this-&gt;getDoctrine()
          -&gt;getRepository('AppBundle:Musee')
          -&gt;findAll();
  
      return $musee;
  }
  
  
  }
  </code></pre>
  
  <p>I also used a serializer file, I wonder if my problem does not come from there... Though all this elements are in my database as I generated it with doctrine.</p>
  
  <pre><code>AppBundle\Entity\Musee:
    attributes:
      id:
        groups: ['musee']
      nom:
        groups: ['musee']
      adresse:
        groups: ['musee']
      horaire_ouverture:
        groups: ['musee']
      horaire_fermeture:
        groups: ['musee']
      bateaux:
        groups: ['musee']
  </code></pre>
  
  <p>My problem is when I try to call my localhost:8000/musee, I get the good amount of brackets compared to what is inside my database, but they appear empty.</p>
  
  <p>I think I might be missing a step but I'm not sure where to search. Where do you think I should look?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>The version of Symfony that I have is 3.4.
  I enabled serializer in my config.yml and installed with composer : jms/serializer-bundle.
  In my app Kernel I have : </p>
  
  <pre><code> new FOS\RestBundle\FOSRestBundle(),
   new JMS\SerializerBundle\JMSSerializerBundle(),
   new Nelmio\CorsBundle\NelmioCorsBundle(),
  </code></pre>
  
  <p>The problem is common to all my entities. I get the right amount of brackets but no content inside. </p>