Skip to content

Commit 7d2b82c

Browse files
SpadXIIIpmelab
authored andcommitted
EntityFieldPropertyDeriver overrides parents (#925)
EntityFieldPropertyDeriver overrides the parents defined in the GraphQLField-annotation. In RC2, the parents defined in the annotation were added to the array instead of overridden.
1 parent 038dc82 commit 7d2b82c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/graphql_core/src/Plugin/Deriver/Fields/EntityFieldPropertyDeriver.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ protected function getDerivativeDefinitionsFromFieldDefinition(FieldDefinitionIn
2121
$entityType = $this->entityTypeManager->getDefinition($entityTypeId);
2222
$supportsBundles = $entityType->hasKey('bundle');
2323

24+
if (!isset($basePluginDefinition['parents'])) {
25+
$basePluginDefinition['parents'] = [];
26+
}
27+
28+
$parents = [StringHelper::camelCase('field', $entityTypeId, $supportsBundles ? $fieldBundle : '', $fieldName)];
2429
return ["$entityTypeId-$fieldBundle-$fieldName" => [
25-
'parents' => [StringHelper::camelCase('field', $entityTypeId, $supportsBundles ? $fieldBundle : '', $fieldName)],
30+
'parents' => array_merge($parents, $basePluginDefinition['parents']),
2631
] + $basePluginDefinition];
2732
}
2833

2934
return [];
3035
}
31-
}
36+
}

0 commit comments

Comments
 (0)