CircleOfNice / DoctrineRestDriver

GNU General Public License v3.0
153 stars 44 forks source link

Association ManyToMany #52

Open SebHoremans opened 7 years ago

SebHoremans commented 7 years ago

Hi, Is there a method to force the route to get/set the many to many associations.

For example I got a user entity and a site entity. These two has a many to many relationship : Users Has Sites and Sites Has Users.

How can i get these relation by a standard REST path such as : /users/{id}/sites and/or /sites/{id}/users

Thanks

SebHoremans commented 7 years ago

A small re-up because this problem stopped our project for now. Thanks

TobiasHauck commented 7 years ago

What exactly happens using a many to many relation? I think it should work as expected. If not I think this is an easy one. May you provide some more information? Thanks!

SebHoremans commented 7 years ago

Yes in fact the url call by the driver to get the sites for a specific user is

GET http://localhost:8000/sites?t_user_has_site_uhs.uhs_user_id=1

But I would like to tell the driver that the correct url is :

GET http://localhost:8000/users/1/sites

TobiasHauck commented 7 years ago

Ok got you. This should be supported. I will have a look in a few hours.

SebHoremans commented 7 years ago

Wonderful !

TobiasHauck commented 7 years ago

After playing with what I've built so far I know what's going wrong / what needs to be done.

We need another annotation which configures joined properties.

I try to work on that the next days

SebHoremans commented 7 years ago

Thanks a lot If you need some validation or help please let me know.

donjuandem commented 7 years ago

@TobiasHauck shouldn't it be possible to reuse those?

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/annotations-reference.html#annref-jointable

SebHoremans commented 7 years ago

Hello, @TobiasHauck have you ever been able to take the time to look at this point ?

Have you ever been able to take the time to look at this. I would like to help you, but I do not know how I can do it.

TobiasHauck commented 7 years ago

Hey Seb,

indeed I had no time to have a deeper look at this. Maybe we should have a chat on Skype. You can send me your nick name via email which you can find on my public Github profile. See you soon and thank you for your help!!