JMSSerializerBundle
JMSSerializerBundle copied to clipboard
Expose `field_name` with discriminator map
Is there a way to expose the field name when using a discriminator map?
Acme\UserBundle\Entity\User:
exclusion_policy: ALL
discriminator:
field_name: type
map:
userType1: Acme\UserBundle\Entity\userType1
userType2: Acme\UserBundle\Entity\userType2
I tried:
//...
properties:
type:
expose: true
But this doesn't work... any idea if this is possible?
The discriminator field_name is an actual field in the serialized data. So, your data should look something like:
{
"type": "userType1"
}