Lakion / Lionframe

Rapid API development framework for PHP.
http://lakion.com/lionframe
MIT License
215 stars 11 forks source link

manage entity with file #30

Open yusleyorea opened 7 years ago

yusleyorea commented 7 years ago

I'm trying to manipulate an attached entity representing the files with a document entity, but can not find how to do it from the documentation in http://lakion.com/lionframe. Is there any tutorial or example where it can guide me.

Another thing, I'm trying to set the serialization of an entity that inherits from FOSUser model, to not display the password field among others, but it does not work either :-( looks so my yml:

Custom\UserBundle\Entity\User:
  exclusion_policy: ALL
  xml_root_name: user
  properties:
      id:
          expose: true
          type: integer
          xml_attribute: true
      email:
          expose: true
          type: string
      displayname:
          expose: true
          type: string
      password:
          expose: false
      salt:
          expose: false
      email_canonical:
          expose: false
      username_canonical:
          expose: false
      username:
          expose: false
      credentials_expired:
          expose: false
      expired:
          expose: false
      locked:
          expose: false

I am also try removing filds with expose false, but it always get all fields from the both entities.

lchrusciel commented 7 years ago

Lionframe is based on jmsserializer, so probably you will need to look for an answer in theirs documentation.

Unfortunately, mappings are not inherited. If you want to change a default FOSUser model mapping, you have to define custom mapping in config file, and then change definition for this model only.

jms_serializer:
    metadata:
        directories:
            fos-user:
                namespace_prefix: "FOS\\UserBundle\\Model"
                path: "@AppBundle/Resources/config/serializer/fos"

Then in src/AppBundle/Resources/config/serializer/fos you can adjust your configuration.

Anyway, please ask such question on stackoverflow.