You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for a way how to mark the whole DTO tree as a part of a serializer group, because #[Serializer\Groups([... works only on the property levels, then if you request the group in the serialization context, any property - whatsoever nested - has to have the group defined.
Now when the groups are used during serialization to JSON through SerializationContext, the $kidDTO will result in an empty object kidDTO: {} unless, the groups are added to all its properties.
This is very unhandy, since some DTOs are so granular and shared among other DTOs that adding all groups of all DTOs from the parent tree to all the subtree properties is simply unrealistic and would create unnecessary code mess.
Is there a way how to do one of the following:
Set on the property that for a certain group, the whole subtree should be included? (preferred)
Define the Groups on the class level? (compromise)
(1.) would especially be appreciated in case I want to nest some external DTO where I can't really add my custom serialization groups.
The text was updated successfully, but these errors were encountered:
I think at the moment serialiser do not support such options. Feel free to propose some Pull Request with the changes for it - I think it should be kinda easy to implement in GroupsExclusionStrategy :)
I am looking for a way how to mark the whole DTO tree as a part of a serializer group, because
#[Serializer\Groups([...
works only on the property levels, then if you request the group in the serialization context, any property - whatsoever nested - has to have the group defined.Now when the groups are used during serialization to JSON through SerializationContext, the
$kidDTO
will result in an empty objectkidDTO: {}
unless, the groups are added to all its properties.This is very unhandy, since some DTOs are so granular and shared among other DTOs that adding all groups of all DTOs from the parent tree to all the subtree properties is simply unrealistic and would create unnecessary code mess.
Is there a way how to do one of the following:
(1.) would especially be appreciated in case I want to nest some external DTO where I can't really add my custom serialization groups.
The text was updated successfully, but these errors were encountered: