Skip to content

Fix relations/properties pointing to document folders#1105

Open
blankse wants to merge 2 commits into
pimcore:2026.1from
blankse:fix_document_folder_relation
Open

Fix relations/properties pointing to document folders#1105
blankse wants to merge 2 commits into
pimcore:2026.1from
blankse:fix_document_folder_relation

Conversation

@blankse

@blankse blankse commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Bug

When a relation, an object/document property or an editable relation targets a document folder, the GraphQL query fails with:

unknown document type: document_folder   (GraphQL/Service.php, getDocumentTypeDefinition)

The resolveType() methods of the relation/property resolvers handle the document element type via getDocumentTypeDefinition('document_' . $documentType). For a folder, $documentType is folderdocument_folder, which is not a registered type (only _document_folder is). 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_folder type — mirroring how object folders are already handled (_object_folder).

Affected resolvers:

  • src/GraphQL/DataObjectType/AbstractRelationsType.php
  • src/GraphQL/General/AnyTargetType.php
  • src/GraphQL/General/AnyDocumentTargetType.php
  • src/GraphQL/PropertyType/ObjectsType.php

Notes

Analogous to the object-folder fix. php -l clean on all four files.

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>
@blankse blankse force-pushed the fix_document_folder_relation branch from 1697967 to 72cc832 Compare June 9, 2026 12:50
@blankse blankse changed the base branch from 1.9 to 2026.1 June 9, 2026 12:50
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

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.

2 participants