Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4110

Update Many-to-Many relation in Api Platform via RESTful

$
0
0

You have two entities: Page and Tags and a Many-to-Many relationship between them.

If you want to add tag with id=1 to page with id=1, call:

PATCH /api/pages/1{"tags":["/api/tags/1"]}

If you want to add tag with id=2 you have to repeat also tag id=1, although it would be removed:

PATCH /api/pages/1{"tags":["/api/tags/1","/api/tags/2"]}

But: What if I have thousands of tags of a page? Is there no any other way do directly call anything to add or remove a single tag without building a request with all tags?

My current versions:

"api-platform/core": "^3.2""doctrine/orm": "^3.1""symfony/*": "7.0.*"

Viewing all articles
Browse latest Browse all 4110

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>