JMS Serializer serialize object in object with diffrent view
I'm developing a RESTful service with Symfony2, JMS Serializer Bundle , FOS Rest Bundle and Hateoas Bundle . There are 2 entities User and Company and I want to, when I serialize a Company get larger detail. But, when serializing User related Company show only Company ID and name object or just ID as integer. I have serialize policy like below. User Acme\UserBundle\Entity\User: exclusion_policy: ALL xml_root_name: user properties: id: expose: true type: integer company: expose: true type: Acme\CompanyBundle\Entity\Company name: expose: true type: string surname: expose: true type: string