Skip to content

Commit 65833f1

Browse files
authored
[GraphQL] Add resolveType to custom type converter (#1209)
1 parent 50aa5e6 commit 65833f1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/graphql.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ Your custom type is now registered and is available in the `TypesContainer`.
12271227

12281228
To use it please [modify the extracted types](#modify-the-extracted-types) or use it directly in [custom queries](#custom-queries) or [custom mutations](#custom-mutations).
12291229

1230-
## Modify the Extracted Types
1230+
## Modify the Extracted Types
12311231

12321232
The GraphQL schema and its types are extracted from your resources.
12331233
In some cases, you would want to modify the extracted types for instance to use your custom ones.
@@ -1251,6 +1251,7 @@ namespace App\Type;
12511251
12521252
use ApiPlatform\Core\GraphQl\Type\TypeConverterInterface;
12531253
use App\Model\Book;
1254+
use GraphQL\Type\Definition\Type as GraphQLType;
12541255
use Symfony\Component\PropertyInfo\Type;
12551256
12561257
final class TypeConverter implements TypeConverterInterface
@@ -1275,6 +1276,14 @@ final class TypeConverter implements TypeConverterInterface
12751276
12761277
return $this->defaultTypeConverter->convertType($type, $input, $queryName, $mutationName, $resourceClass, $rootResource, $property, $depth);
12771278
}
1279+
1280+
/**
1281+
* {@inheritdoc}
1282+
*/
1283+
public function resolveType(string $type): ?GraphQLType
1284+
{
1285+
return $this->defaultTypeConverter->resolveType($type);
1286+
}
12781287
}
12791288
```
12801289

0 commit comments

Comments
 (0)