fix(doctrine): fetch_data=false reference for stateOptions resources#8387
Merged
soyuka merged 1 commit intoJul 8, 2026
Merged
Conversation
getReferenceIdentifiers() keeps only the link that points at the resource itself, selecting it by comparing the link's fromClass to $entityClass, the stateOptions entity class. A Link's fromClass is always the resource class, so for a DTO resource the two never coincide: the fetch_data=false fast path returned null and fell through to the full item query, running the item query extensions it was meant to skip. A relation SearchFilter then fails open. getIdFromValue() resolves the IRI via getResourceFromIri, an item query extension excludes the row, the null is swallowed, and no constraint is emitted at all. Compare against $operation->getClass() instead. The entity identifier guard below is unchanged, so a resource whose API identifier is not a Doctrine identifier still falls through; for a resource that is not a DTO, $operation->getClass() === $entityClass and behavior is identical.
Member
|
thanks @bendavies ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
fetch_data=falsereference fast path (#8295) never triggered for a DTO/stateOptionsresource:getReferenceIdentifiers()matched the identifier link'sfromClassagainst$entityClass(the entity), but aLink'sfromClassis always the resource class. For a DTO resource it therefore fell through to the query and ran the item extensions it should have skipped, which (viagetResourceFromIri(fetch_data: false)inSearchFilterTrait::getIdFromValue()) makes a relationSearchFiltersilently drop its constraint.Fix: compare against
$operation->getClass(). The entity identifier guard below is unchanged (auuidAPI id over anidkey still falls through), and non-DTO resources are unaffected since$operation->getClass() === $entityClass.Covered by unit tests in
ItemProviderTestand a functional test that fails before the change.