I have a Symfony2/AngularJS application and using FOSRestBundle with JMS Serializer Bundle. For normal entities every thing works great but in one of my entities that contains a collection of messages (fro example a topic entity) I need to return subset of messages in different situations.
For example for the Topic Entity Owner I want to return all messages of the topic for message owner I want to return just the message that posts with the message owner and for other users I don't want to return any messages but they can post a message on topic.
I'm not sure where to implement this. In the topic entity or in the controller or ...
There is a filtering a feature in doctrine but I'm not sure where to use if, In entity or Model/Controller
http://doctrine-orm.readthedocs.org/en/ ... ollections