fix: handle item iri with identifiers in LegacyIriConverter#5670
Merged
soyuka merged 2 commits intoAug 1, 2023
Conversation
Co-authored-by: Kévin Dunglas <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello, a small fix for when using the
\ApiPlatform\Core\Api\LegacyIriConverterThe Problem:
#5630 Introduced a nice way to fix the IriConverterInterface deprecation before turning off the
metadata_backward_compatibility_layer.One issue I ran into is that
LegacyIriConverter::getIriFromResourcedecides if the iri will be Item level or Collection level solely based on if the given$itemparameter is a string vs an object.With this methodology, I would have instantiate a new object just to trigger the Item level iri conversion.
(To compare, The new IriConverterInterface handles this decision smartly, using the metadata of the Operation and the given Object).
Proposed solution
Previously, the old IriConverterInterface had 2 distinct methods to split this (
getItemIriFromResourceClassandgetIriFromResourceClass)— the only difference being an extra parameterarray $identifiers.This adds back the ability to identify a Resource based on className + identifiers.