Skip to content

fix(state): use managed entity as previous_data - #8895

Merged
soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix-8892-put-mapped-previous-data
Dec 1, 2026
Merged

soyuka merged 2 commits into
api-platform:5.0from
soyuka:fix-8892-put-mapped-previous-data

Conversation

@soyuka

@soyuka soyuka commented Nov 27, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 5.0
Tickets Closes #8892
License MIT
Doc PR n/a

#8867 mapped the previous resource into a new entity to build previous_data. Non-writable identifiers (private id with a getter only) are skipped by the ObjectMapper, so the Doctrine standard PUT got no identifier, cloned that transient entity and persisted it next to the update.

previous_data is now a clone of the managed entity read by the provider, taken before the input is mapped onto it. The resource mapping fallback stays for when no mapped_data is available.

MappedResourcePutTest already had the failing shape, it now asserts the id and the row count.

Mapping the previous resource to a new entity drops non-writable
identifiers, so the Doctrine standard PUT persisted a duplicate.

Fixes api-platform#8892
@soyuka
soyuka merged commit d5dbbef into api-platform:5.0 Dec 1, 2026
108 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