Symfony serializer - set circular reference global
Is there any way to set the circular reference limit in the serializer component of Symfony (not JMSSerializer) with any config or something like that? I have a REST Application with FOSRestBundle and some Entities that contain other entities which should be serialized too. But I'm running into circular reference errors. I know how to set it like this: $encoder = new JsonEncoder(); $normalizer = new ObjectNormalizer(); $normalizer->setCircularReferenceHandler(function ($object) { return $object->getName(); }); But this has to be done in more than one controller (overhead for me). I want to set