Only properties of the JOSSerializer class of the FOSUser class

I have a user class of user that 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: abstract properties from the FOSUser model are displayed, but the properties in the custom extended class are not.

To open the properties, I have 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 the $ name property. Which should be opened by my .yaml file:

ErwineEberhard\SecurityBundle\Entity\User:
    exclusion_policy: none
    properties:
        name:
            expose: true
            groups: [list, details]

Doctrine makes me add $idto the exteded class. $idAppears only when added * @ExclusionPolicy("all")to a user class. When I add @Expose to indicate no difference.

How to do it?

+4

All Articles