Reputation: 45
I have an entity with a manyToOne relation, I want to serialize this entity with JMS serializer on Symfony. But I want the related entity on the same level of the main entity, like if fields are just complementary fields of my main entity.
I have this :
"parcel_movement_action_button": {
"code": "string",
"type": "string"
},
"button_class": "string",
"value": "string"
I want this :
"code": "string",
"type": "string",
"button_class": "string",
"value": "string"
Is it possible ?
Upvotes: 0
Views: 583
Reputation: 472
Yes it's possible, you must use virtual property to do that https://jmsyst.com/libs/serializer/master/reference/annotations#virtualproperty
Upvotes: 2