For example, let's say that I have two entities, Article
and Comment
, comments mapped to articles through an unidirectional manyToOne relation. What I want to know is, if it's possible to serialize relation, but in the mappedOne, only serialize the ID.
For example, if I serialize an article, I'll get a complete json representation of it (including id, title, content...).
{"title":"article title", "content":"article content", "id":"7"}
But if I serialize a comment, I want it to hava a complete json representation of itself, but in the article field, I only want the article id.
{"id":"2", "author":"foo","content":"comment content","linked_article":{"id":"7"}}
Thanks a lot !