diff --git a/modules/graphql_core/src/Plugin/Deriver/Fields/EntityReferenceQueryDeriver.php b/modules/graphql_core/src/Plugin/Deriver/Fields/EntityReferenceQueryDeriver.php index b6d02e5b2..f0d7fcef1 100644 --- a/modules/graphql_core/src/Plugin/Deriver/Fields/EntityReferenceQueryDeriver.php +++ b/modules/graphql_core/src/Plugin/Deriver/Fields/EntityReferenceQueryDeriver.php @@ -92,15 +92,16 @@ public function getDerivativeDefinitions($basePluginDefinition) { $targetType = $this->entityTypeManager->getDefinition($targetTypeId); $fieldName = $fieldDefinition->getName(); + $parents = []; if ($fieldDefinition instanceof BaseFieldDefinition || !$entityType->hasKey('bundle')) { $parents = [StringHelper::camelCase($entityTypeId)]; } - else { - $parents = []; + elseif (isset($fieldMap[$entityTypeId][$fieldName])) { foreach ($fieldMap[$entityTypeId][$fieldName]['bundles'] as $bundle) { $parents[] = StringHelper::camelCase($entityTypeId . '_' . $bundle); } } + $derivative = [ 'parents' => $parents, 'name' => StringHelper::propCase('query', $fieldName),