diff --git a/src/CoreComposableResolver.php b/src/CoreComposableResolver.php index 2a6485dd7fd3f5e08b58280956126e9c4f68a3fc..adfddacf60bddada8195abc4972a24b8a70be374 100644 --- a/src/CoreComposableResolver.php +++ b/src/CoreComposableResolver.php @@ -29,7 +29,6 @@ use Drupal\Core\TypedData\Plugin\DataType\Timestamp; use Drupal\Core\TypedData\Plugin\DataType\Uri; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\Url; -use Drupal\file\FileInterface; use Drupal\file\Plugin\Field\FieldType\FileFieldItemList; use Drupal\graphql\GraphQL\Execution\ResolveContext; use Drupal\graphql\GraphQL\ResolverBuilder; @@ -423,16 +422,9 @@ class CoreComposableResolver { * The default type. */ public static function resolveTypeDefault($value, ResolveContext $context, ResolveInfo $info) { - $coreComposableConfig = CoreComposableConfig::fromConfiguration($context->getServer()->get('schema_configuration')['core_composable'] ?? []); - if ($value instanceof FileInterface) { - // Special handling here because if we return "File" as a string, - // the execution resolver will call "is_callable('File')", which evaluates - // to true. This then ends up calling the PHP file() method without - // any arguments, which will throw an error. - return $info->schema->getType('File'); - } - elseif ($value instanceof EntityInterface) { - return $coreComposableConfig->getTypeNameForEntity($value); + if ($value instanceof EntityInterface) { + $type = EntitySchemaHelper::getGraphqlTypeForEntity($value); + return $type; } elseif ($value instanceof FieldItemInterface) { return EntitySchemaHelper::getTypeForFieldItem($value);