Skip to content

feat(state)!: map to the output class on mapped writes - #8942

Open
soyuka wants to merge 2 commits into
output-resource/3-viewfrom
output-resource/4-mapper-writes
Open

soyuka wants to merge 2 commits into
output-resource/3-viewfrom
output-resource/4-mapper-writes

Conversation

@soyuka

@soyuka soyuka commented Dec 3, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main (6.0, merge after v5.1.0)
Tickets Refs #8849, #8497
License MIT
Doc PR api-platform/docs#2321 (to rewrite once the stack lands)

Part 4/6 of the RFC #8849 stack (https://github.com/api-platform/core/stack/8945), review commit by commit: the first commit is the failing test.

With the ObjectMapper, write operations now map the persisted entity to the output class (a processor that already returns the output is not mapped twice). Location / Content-Location are the IRI of the resource the operation acted on: the item template of a view, else the persisted entity, never the collection IRI anymore (no header when nothing identifies the resource).

Tests ported from #8497 (thanks @dylan-rumble, co-author): tests/Functional/MappedResourceOutputTest.php, POST/PATCH/PUT, also green with USE_SYMFONY_LISTENERS=1.

soyuka and others added 2 commits December 3, 2026 15:33
Refs #8849

Co-authored-by: Dylan van der Hout <dylan@rumble.nl>
ObjectMapperOutputProcessor maps the persisted entity to the output
class (an output returned by a custom processor is not mapped twice).
Location and Content-Location are the IRI of the resource the operation
acted on: the item template of a view, else the persisted entity, never
the collection IRI.

Refs #8849

Co-authored-by: Dylan van der Hout <dylan@rumble.nl>
@soyuka
soyuka added this pull request to stack #8945 December 3, 2026 15:14
@soyuka soyuka changed the title output resource/4 mapper writes feat(state)!: map to the output class on mapped writes Dec 3, 2026
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