zf-fr/zfr-rest

Handle associations in multiple mappedBy

bakura10 opened this issue · 1 comments

I've found a tricky use case:

  • Imagine a "Conversation" entity that association to two users: the creator of the conversation and "the receiver".

If I want to access all conversations from a user, I'd like the endpoint /users/4/conversations. So I need to have a OneToMany associaiton on user. The problem is that I can't set the mappedBy because Dcotrine does not support multiple mapped by. As a consequence we can't take advantage of routing.

The only solution I've found so far is to create a custom routes, and manually create a custom query.

Fixed by #184