FOSRestBundle
FOSRestBundle copied to clipboard
Annotation for Serialization groups for specific paths doesn't work
Overriding serialization for Deeper Branches of the Object doesn't work with annotations. I'm trying to specify serialization group for child object of my DTO
* @Rest\View(
* serializerGroups={"Default", "child": {"test"}}
* )
And it doesn't work, the problem is that FOS\RestBundle\Context\Context class method addGroup can't handle named index, so my groups become ['default', ['test']] instead of ['default', 'child' => ['test']] it works if you override them in controller action using setGroups method. But FOS\RestBundle\EventListener\ViewResponseListener is using addGroups method to handle annotations configuration instead of setGroups (is there a reason behind this ?)
+1
Please have a look at this thread on StackOverflow:
https://stackoverflow.com/questions/46367244/jms-serializer-overriding-groups-in-fosrestbundle/47219227#47219227
I faced the same problem.