Search code examples
symfonyfosrestbundlejmsserializerbundle

Symfony FOSRestBundle enableMaxDepthChecks default to true


Is it possible to set the default value for enableMaxDepthChecks to true?

Currently I have to add the following annotation to every route:

@View(serializerEnableMaxDepthChecks=true)

Is there a way to set this in the config or elsewhere to be the default?


Solution

  • Place this into your config.yml

    jms_serializer:
        default_context:
            serialization:
                enable_max_depth_checks: true
    

    BUT! After making these changes, the parameter serializerEnableMaxDepthChecks becomes non-working, so you can't set it to false , and I don't know why...