'Shopware 6 Admin API - How to delete/update entites by custom route
I'm working on a custom entity which I want to manage via the sw6 admin api.
Therefore I want to be able to write entities by using post-, get- and delete-requests.
SW 6 automatically generates the desired routes for me. But I want to delete/update a specific entity and sw6 only generates routes with the primary key (e.g. /api/entity/{id}). For my use case I need to delete entities by a route with a specific field though.
I tried to achieve that by making my field a primary key. That doesn't work though, because sw6 expects an uuid/binary value and I specifically need a string value.
Is there any way to define a custom route (e.g. /api/entity/{myfield}) and write a custom controller or a way to use a string field as primary key?
Solution 1:[1]
I believe you can find your answer here by overwriting the existing routes with your custom Override - existing route.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ouflak |
