Fix relations/properties pointing to document folders#1105
Open
blankse wants to merge 2 commits into
Open
Conversation
All document types have type and properties fields, but the relation type resolvers did not handle folders, pointing them to a non-existing 'document_folder' type definition instead of the registered '_document_folder'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1697967 to
72cc832
Compare
|
|
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.



Bug
When a relation, an object/document property or an editable relation targets a document folder, the GraphQL query fails with:
The
resolveType()methods of the relation/property resolvers handle thedocumentelement type viagetDocumentTypeDefinition('document_' . $documentType). For a folder, $documentType isfolder→document_folder, which is not a registered type (only_document_folderis). This makes any query that can resolve a document folder through such a field error out.Fix
Add a folder guard that returns the registered
_document_foldertype — mirroring how object folders are already handled (_object_folder).Affected resolvers:
src/GraphQL/DataObjectType/AbstractRelationsType.phpsrc/GraphQL/General/AnyTargetType.phpsrc/GraphQL/General/AnyDocumentTargetType.phpsrc/GraphQL/PropertyType/ObjectsType.phpNotes
Analogous to the object-folder fix.
php -lclean on all four files.