I want to serialize and return only a few attributes of my entity with JMSSerializerBundle and FOSRestBundle.
For example I have this attributes:
User
- Username
- Birthday
- Comments
Comments
- Text
- DateTime
Users with the role ROLE_ADMIN should get a serialized object of the whole user-object. ROLE_USER should only get the username and all comments.
What's the easiest way to implement the Symfony2 Security Component in JMSSerializerBundle? Or do I need to implement this in my controller and serialize it "by hand"?
Thank you very much