Skip to content

fix(doctrine): accept resolved resources in links - #8687

Merged
soyuka merged 4 commits into
api-platform:5.0from
soyuka:fix/8494-resolved-uri-variable
Oct 16, 2026
Merged

soyuka merged 4 commits into
api-platform:5.0from
soyuka:fix/8494-resolved-uri-variable

Conversation

@soyuka

@soyuka soyuka commented Oct 15, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 5.0
Tickets Closes #8494
License MIT
Doc PR

With write_uri_variable on a ReadLinkParameterProvider link, the uri variable holds the resolved resource. The ORM and ODM links handlers bound it as a query parameter, so any Doctrine-backed link failed with Object of class ...Company could not be converted to string.

The links handlers now read the link's identifiers off the resource when the uri variable is an instance of the link's class. Composite identifiers expand in place, so the positional consumption stays the same. getIdentifierValue() is untouched, and so is the processor: it never receives the resolved resource, because the controller passes uri variables by value.

The instanceof guard matters: uri variables are already objects for Uuid/Ulid identifiers (testGetRamseyUuidDummy goes 500 without it).

Eloquent is not part of this: Laravel doesn't register ReadLinkParameterProvider, so a resolved resource can't reach its links handler yet.

@soyuka
soyuka merged commit 52ae551 into api-platform:5.0 Oct 16, 2026
112 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant