Open Rafikooo opened 2 months ago
i think its related with https://github.com/api-platform/core/issues/6522
Any plans on this? I currently struggle with such an issue and it's really painful.
https://api-platform.com/docs/guides/handle-links/ should make this work quite easily no?
@soyuka somewhat it helped. But I guess it should be available out-of-the-box, maybe if toProperty: 'entity.subentity'
, is dot separated, then do adequate joins?
API Platform version(s) affected: 3.3.11
Description
While upgrading the Sylius API to APIP3, we faced an issue with subresource configuration. Here’s a specific real-life example to illustrate the problem: https://syliusdev-demoapip3.bunnyenv.com/api/v2#/ProductOption We have upgraded this resource to APIP3 with a minor workaround:
Current behaviour (result of the POST request):
Current subresource's generated IRI:
Expected one:
Our workaround requires defining only two uriVariables:
The documentation does not cover this case, but we experimented with the configuration and successfully generated the expected IRI:
We access the root resource through the middle resource using the
toProperty="translatable.option"
attribute, which works well for GET requests. However, it fails for updates, resulting in the following error:We have a similar case with our
Order <-> OrderItem <-> OrderItemUnit
resource configuration, as shown in the following config:We can successfully construct an IRI for a double-nested resource:
But, we cannot access the
OrderItemUnit
resource directly because of the following error:We couldn't find a fully functional solution, so we decided to ask you this question:
Are double-nested subresource scenarios possible with APIP3? Did you consider these cases during subresource design? If so, please offer guidance on configuration or expand the documentation for current and future users.
Best regards, Rafał