0

I'm getting this error, and tried every solution, but, still couldn't figure it out. someone got the same error as me ?

A circular reference has been detected when serializing the object of class "AppBundle\Entity\Loisir" (configured limit: 1)

My code

    public function allAction()
    {
        $Loisirs =$this->getDoctrine()->getManager()
            ->getRepository('AppBundle:Loisir')->findALL();

        $serializer =new Serializer([new ObjectNormalizer()]);
        $formatted =$serializer->normalize($Loisirs);
        return new JsonResponse($formatted);    
    }
CAmador
  • 1,881
  • 1
  • 11
  • 19
  • Welcome on Stackoverflow. Could you please provide code of your Loisir Entity? – Alexandre Tranchant Apr 27 '19 at 17:31
  • i think you have some bidirectional relationship between Loisir Entity and another one which causes the issue during serialization, can you add your Loisir Entity's code to confirm if that's really the problem, thank you. – Abdelkarim EL AMEL Apr 27 '19 at 19:01
  • check this link `https://stackoverflow.com/questions/44286530/symfony-3-2-a-circular-reference-has-been-detected-configured-limit-1` – habibun Apr 28 '19 at 02:45

0 Answers0