Skip to content
Snippets Groups Projects

Revert "Fix error when resolving type for "File""

Open abelass requested to merge issue/graphql_core_schema-3489139:fix_file_error into 1.0.x
1 file
+ 3
11
Compare changes
  • Side-by-side
  • Inline
@@ -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);
Loading