FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

Annotation for Serialization groups for specific paths doesn't work

Open rokisb opened this issue 8 years ago • 2 comments

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 ?)

rokisb avatar Jul 07 '17 09:07 rokisb

+1

ofo78 avatar Jan 25 '18 09:01 ofo78

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.

lukepass avatar Jun 05 '18 15:06 lukepass