I've a custom User Class which extends from the FOSUser Model:
use FOS\UserBundle\Model\User as BaseUser;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
/**
* @ExclusionPolicy("all")
*/
class User extends BaseUser
My problem is: The Abstract properties from the FOSUser Model are exposed, but the properties in the custom extended class not.
To expose the properties I've two yaml files: 1) MyBundle/../Resources/config/serializer/fos/Model.User.yml 2) SecurityBundle/../Resource/config/serializer/Entity.User.yml
My custom User class has a property $name. Which should be exposed by my .yaml file:
ErwineEberhard\SecurityBundle\Entity\User:
exclusion_policy: none
properties:
name:
expose: true
groups: [list, details]
Doctrine compels me to add a $id
in the exteded class. The $id
is only exposed when I add * @ExclusionPolicy("all")
in my custom User class.
When I add @Expose to name, no differences.
How to accomplish this?