Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_depth in YML config is ignored #498

Closed
jakenoble opened this issue Sep 23, 2015 · 3 comments
Closed

max_depth in YML config is ignored #498

jakenoble opened this issue Sep 23, 2015 · 3 comments

Comments

@jakenoble
Copy link

The following is not being read as expected because only ID is shown. But the max_depth value is being ignored. I have cleared the cache several times now but still no luck.

Have I missed something when using max_depth and YML?

AppBundle\Entity\School:
  exclusion_policy: ALL
  properties:
    id:
      expose: true
    programs:
      expose: true
      max_depth: 1
@akomm
Copy link

akomm commented Feb 16, 2016

Same issue here. I have to explicitly enable the max depth checks like that:

use JMS\Serializer\SerializationContext;

$context = SerializationContext::create()->enableMaxDepthChecks();

Or access the context via any API you use and enable the checks same way, e. G. fos/rest-bundle:

use FOS\RestBundle\View\View;

$view = View::create(/* ... */);
$view->getSerializationContext()->enableMaxDepthChecks();

@danger2k7
Copy link

Same problem here .... any news on a fix ?

@goetas
Copy link
Collaborator

goetas commented Mar 21, 2017

this is how the feature is supposed to work.
see here http://jmsyst.com/libs/serializer/master/cookbook/exclusion_strategies#limiting-serialization-depth-of-some-properties or http://symfony.com/doc/master/bundles/FOSRestBundle/annotations-reference.html#view

@goetas goetas closed this as completed Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants