Skip to content

feat(state): map abstract targets to subtypes - #8887

Closed
soyuka wants to merge 1 commit into
polymorphism/4-doctrinefrom
polymorphism/5-object-mapper
Closed

soyuka wants to merge 1 commit into
polymorphism/4-doctrinefrom
polymorphism/5-object-mapper

Conversation

@soyuka

@soyuka soyuka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets Closes #8865
License MIT
Doc PR

Mapping to an abstract target resolves the subtype whose #[Map] accepts the source, so a polymorphic resource backed by stateOptions + ObjectMapper works. Decorator until symfony/symfony#68452 lands.

Test: tests/Functional/MappedDiscriminatedResourceTest.php

Part 5/6 of the polymorphism stack (#8889), replaces #8874.

@soyuka
soyuka added this pull request to stack #8889 November 26, 2026 17:08
@soyuka
soyuka force-pushed the polymorphism/5-object-mapper branch from 67ad462 to d190804 Compare November 27, 2026 09:30
@soyuka
soyuka force-pushed the polymorphism/4-doctrine branch from aff89f0 to f8193a7 Compare November 27, 2026 09:30
@soyuka
soyuka force-pushed the polymorphism/5-object-mapper branch from d190804 to 6d64da5 Compare November 27, 2026 10:25
@soyuka
soyuka force-pushed the polymorphism/4-doctrine branch from f8193a7 to c15836a Compare November 27, 2026 10:25
Resolve an abstract object mapper target to the subtype whose mapping
accepts the source, so a mapped polymorphic resource can be written and
read through the object mapper.
@soyuka
soyuka force-pushed the polymorphism/4-doctrine branch from c15836a to ef6bdd2 Compare November 27, 2026 10:43
@soyuka
soyuka force-pushed the polymorphism/5-object-mapper branch from 6d64da5 to 89f1674 Compare November 27, 2026 10:43
@soyuka

soyuka commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Closing, we'll fix this in Symfony instead: symfony/symfony#68452. Mapping to an abstract class or an interface will work once it lands.

@soyuka soyuka closed this Nov 27, 2026
@soyuka
soyuka removed this pull request from stack #8889 November 27, 2026 14:56
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.

[RFC] Discriminated resources: one resource, its subtypes from the Serializer discriminator map

1 participant