Repository navigation
Conversation
soyuka
approved these changes
Nov 24, 2026
soyuka
left a comment
Member
There was a problem hiding this comment.
Nice thanks this is a good idea!
Contributor
Author
|
Thanks. I’ve added a test and a changelog. And I’ve merged |
soyuka
requested changes
Dec 3, 2026
soyuka
left a comment
Member
There was a problem hiding this comment.
Took another look before 5.1, a few things to fix:
- please rebase on main (no merge commit), conflicts are only the
useblock inApiPlatformProviderand the new tests inIriConverterTest - Symfony, Laravel and Mcp still require
api-platform/metadata: ^5.0but their converters now implementUriVariablesFromIriInterfacewhich only exists in 5.1, the Mcp lowest job already fails with "Interface not found", bump to^5.1 - the interface doc says the result can be passed back as
uri_variablestogetIriFromResource(), that's not true with composite identifiers: Symfony returns['first' => '1', 'second' => '2']and the route expects{id}so generating the IRI throws. Either fix the doc or rebuild the composite identifier - Laravel and Symfony don't behave the same behind one interface: Laravel ignores
$context, returns raw strings and doesn't split composite identifiers, Symfony converts values (/books/1gives['id' => 1]vs['id' => '1']). They should return the same thing, no? - in the Mcp decorator, an inner converter without the interface throws
InvalidArgumentException, which is the "bad IRI" exception of the interface so callers will swallow a configuration error. Use aLogicException - the new tests in
tests/Symfony/Routing/IriConverterTest.phpuse Prophecy, we're moving away from it, please use PHPUnit mocks. Also drop the docblocks on the privateresolveIrimethods and the comment inUriVariablesFromIriTest
Also we'll need a docs PR as this is a new public service, thanks!
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.
Adds
UriVariablesFromIriInterface::getUriVariablesFromIri(), which matches an IRI against the router and returns the URI variables of the item it references, without calling the stateprovider. It lives in a separate interface, so
IriConverterInterfaceis untouched and existing implementations and decorators keep working.Functional test (
tests/Functional/UriVariablesFromIriTest.php), the resource's provider throws, so getting a result proves the item is not loaded:Unit tests cover the Symfony, Laravel and MCP converters (
tests/Symfony/Routing/IriConverterTest.php,src/Laravel/Tests/Unit/Routing/IriConverterTest.php,src/Mcp/Tests/Routing/IriConverterTest.php).