Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I already refused a PR like this one, we don't know the nature of
originalData
and URI Variables in the context may not be the right ones anymore. Question is, how is it that we can't extract identifiers fromoriginalData
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in this case identifiers are not in the data but only in the url, something like this :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which makes this empty cf https://github.com/api-platform/core/blob/main/src/Symfony/Routing/IriConverter.php#L183
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
Link
suggests that you're retrieving therealmId
from the propertyrealm
? Isn't the identifier in your $originalData?I wish we had a better extension point for https://github.com/api-platform/core/blob/main/src/Symfony/Routing/IriConverter.php#L187 instead of adding the context there as you won't be able to fix the tests with this change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No i don't have this property in my entity, AFAIK the link never map the property to the entity ? (We tried to do that in other api calls and it was never linked)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another solution would be to be able to configure an IriConverter for a resource, so we can override this behavior per operation / resource ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Link should be a relation between the Resource and something else, in your example the configuration is likely wrong and using Link is useless. Yes the only solution here is to decorate the IriConverter.