-
Notifications
You must be signed in to change notification settings - Fork 3
Serialize annotations
BowlOfSoup edited this page Sep 16, 2020
·
1 revision
Use property 'group' to separate context. See how you can use this in the 'wrapper element' section below.
/**
* @Bos\Serialize(group={"group-name"})
*/
class ClassToBeSerialized
{
When outputting to a specific encoding you can indicate the wrapping element, this element will be the root node. You can and should indicate a group (context), use property 'group' to separate context.
/**
* @Bos\Serialize(wrapElement="SomeWrapperElement", group={"some_group"})
* @Bos\Serialize(wrapElement="data", group={"other_group"})
*/
class ClassToBeSerialized
{
You can have the serializer sort all data by key. The normalized data (array) will be sorted, so the serialized output is also sorted.
/**
* @Bos\Serialize(sortProperties=true)
*/
class ClassToBeSerialized
{