Skip to content

fix(doctrine): put-create under a slug parent link - #8688

Merged
soyuka merged 3 commits into
api-platform:5.0from
soyuka:fix/doctrine-put-create-slug-parent
Oct 16, 2026
Merged

soyuka merged 3 commits into
api-platform:5.0from
soyuka:fix/doctrine-put-create-slug-parent

Conversation

@soyuka

@soyuka soyuka commented Oct 15, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 5.0
Tickets Found while working on #8494
License MIT
Doc PR

A PUT that creates a resource under a parent link whose identifier is not the Doctrine id (e.g. a name slug) crashed with Cannot assign string to property Company::$id of type ?int: PersistProcessor passed the slug to getReference(), which only takes Doctrine identifiers.

When the link identifiers match the Doctrine identifier fields we keep getReference(), otherwise we look the parent up with findOneBy() on the link identifiers (same rule as #8295).

If no parent matches, the relation is left null, same as before for a missing id: this does not add a 404 for an unknown parent.

@soyuka
soyuka merged commit 34c6f00 into api-platform:5.0 Oct 16, 2026
111 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