Skip to content

feat(doctrine)!: eager load from the serialized shape - #8944

Open
soyuka wants to merge 2 commits into
output-resource/5-anonymous-pathsfrom
output-resource/6-eager-loading
Open

soyuka wants to merge 2 commits into
output-resource/5-anonymous-pathsfrom
output-resource/6-eager-loading

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 Fixes #8765, refs #8849, #8836
License MIT
Doc PR api-platform/docs#2321 (to rewrite once the stack lands)

Part 6/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 an output class, or a resource mapped to an entity through stateOptions, the ORM eager loading extension walks the properties of the serialized shape instead of the entity: embedded relations are joined without serialization groups, renamed associations are followed through #[Map], a relation read by a transform (other than MapCollection) stays unjoined. One walker, the legacy path is unchanged.

Tests ported from #8836 (thanks @philpichet, co-author): tests/Functional/Doctrine/StateOptionsEagerLoadingTest.php (10→2, 9→2, 16→3 queries) plus an output-driven case.

BC: such resources get joins they did not get before, max_joins may be reached sooner.

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

Co-authored-by: Philippe Pichet <phil@pichet.eu>
With an output class, or a resource mapped to an entity through
stateOptions, the ORM eager loading extension walks the properties of the
serialized shape instead of the entity: embedded relations are joined
without serialization groups, renamed associations are followed through
#[Map], and a relation read by a transform stays unjoined.

Refs #8849, fixes #8765

Co-authored-by: Philippe Pichet <phil@pichet.eu>
@soyuka
soyuka added this pull request to stack #8945 December 3, 2026 15:14
@soyuka soyuka changed the title output resource/6 eager loading feat(doctrine)!: eager load from the serialized shape 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.

Eager loading for resources mapped to an entity through stateOptions (DTO output)

1 participant