title: Symfony 3.2 A circular reference has been detected (configured limit: 1)
body: <p>I have this two entities in my project </p>
  
  <pre><code>class PoliceGroupe
  {
      /**
       * @var int
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="code", type="string", length=50)
       */
      private $code;
  
      /**
       * @ORM\ManyToMany(targetEntity="PointVente", inversedBy="policegroupe")
       * @ORM\JoinTable(name="police_groupe_point_vente",
       *      joinColumns={@ORM\JoinColumn(name="police_groupe_id", referencedColumnName="id")},
       *      inverseJoinColumns={@ORM\JoinColumn(name="point_vente_id", referencedColumnName="id")}
       *      )
       */
      private $pointVente;
      /**
       * Constructor
       */
      public function __construct($produit)
      {
         $this-&gt;pointVente = new \Doctrine\Common\Collections\ArrayCollection();
      }
  }
  </code></pre>
  
  <p>And here is my other entity </p>
  
  <pre><code>class PointVente
  {
      /**
       * @var string
       *
       * @ORM\Column(name="abb", type="string", length=50)
       */
      private $abb;
  
      /**
       * @var string
       *
       * @ORM\Column(name="libelle", type="string", length=255)
       */
      private $libelle;
  
      /**
       *
       * @ORM\ManyToMany(targetEntity="PoliceGroupe", mappedBy="pointVente")
       */
      private $policegroupe;
      }
  </code></pre>
  
  <p>and i'm trying to run this code in my controller </p>
  
  <pre><code>$encoders = array(new XmlEncoder(), new JsonEncoder());
  $normalizers = array(new ObjectNormalizer());
  $serializer = new Serializer($normalizers, $encoders);
  $em = $this-&gt;getDoctrine()-&gt;getManager();
  $data = $request-&gt;get('data');
  $policegroupe=$em-&gt;getRepository('StatBundle:PoliceGroupe')-&gt;findOneBy(array('id' =&gt; $data));
  $pointventes = $policegroupe-&gt;getPointVente();
  $jsonContent = $serializer-&gt;serialize($pointventes, 'json');
  return new JsonResponse( array('pointventes'=&gt;$jsonContent) );
  </code></pre>
  
  <p>But I get this exception</p>
  
  <pre><code>Symfony\Component\Serializer\Exception\CircularReferenceException: A circular reference has been detected (configured limit: 1).
      at n/a
          in C:\wamp\www\Sys\vendor\symfony\symfony\src\Symfony\Component\Serializer\Normalizer\AbstractNormalizer.php line 194
  </code></pre>
  
  <p>I mapped my entities according to the doctrine annotations. Am I missing something?</p>