16
16
use ApiPlatform \Core \Exception \ResourceClassNotFoundException ;
17
17
use ApiPlatform \Core \GraphQl \Resolver \Factory \ResolverFactoryInterface ;
18
18
use ApiPlatform \Core \GraphQl \Serializer \ItemNormalizer ;
19
- use ApiPlatform \Core \GraphQl \Type \Definition \IterableType ;
20
19
use ApiPlatform \Core \Metadata \Property \Factory \PropertyMetadataFactoryInterface ;
21
20
use ApiPlatform \Core \Metadata \Property \Factory \PropertyNameCollectionFactoryInterface ;
22
21
use ApiPlatform \Core \Metadata \Resource \Factory \ResourceMetadataFactoryInterface ;
@@ -56,10 +55,11 @@ final class SchemaBuilder implements SchemaBuilderInterface
56
55
private $ itemMutationResolverFactory ;
57
56
private $ defaultFieldResolver ;
58
57
private $ filterLocator ;
58
+ private $ typesFactory ;
59
59
private $ paginationEnabled ;
60
60
private $ graphqlTypes = [];
61
61
62
- public function __construct (PropertyNameCollectionFactoryInterface $ propertyNameCollectionFactory , PropertyMetadataFactoryInterface $ propertyMetadataFactory , ResourceNameCollectionFactoryInterface $ resourceNameCollectionFactory , ResourceMetadataFactoryInterface $ resourceMetadataFactory , ResolverFactoryInterface $ collectionResolverFactory , ResolverFactoryInterface $ itemMutationResolverFactory , callable $ itemResolver , callable $ defaultFieldResolver , ContainerInterface $ filterLocator = null , bool $ paginationEnabled = true )
62
+ public function __construct (PropertyNameCollectionFactoryInterface $ propertyNameCollectionFactory , PropertyMetadataFactoryInterface $ propertyMetadataFactory , ResourceNameCollectionFactoryInterface $ resourceNameCollectionFactory , ResourceMetadataFactoryInterface $ resourceMetadataFactory , ResolverFactoryInterface $ collectionResolverFactory , ResolverFactoryInterface $ itemMutationResolverFactory , callable $ itemResolver , callable $ defaultFieldResolver , ContainerInterface $ filterLocator = null , bool $ paginationEnabled = true , TypesFactoryInterface $ typesFactory = null )
63
63
{
64
64
$ this ->propertyNameCollectionFactory = $ propertyNameCollectionFactory ;
65
65
$ this ->propertyMetadataFactory = $ propertyMetadataFactory ;
@@ -70,12 +70,14 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
70
70
$ this ->itemMutationResolverFactory = $ itemMutationResolverFactory ;
71
71
$ this ->defaultFieldResolver = $ defaultFieldResolver ;
72
72
$ this ->filterLocator = $ filterLocator ;
73
+ $ this ->typesFactory = $ typesFactory ;
73
74
$ this ->paginationEnabled = $ paginationEnabled ;
74
75
}
75
76
76
77
public function getSchema (): Schema
77
78
{
78
- $ this ->graphqlTypes ['Iterable ' ] = new IterableType ();
79
+ $ this ->graphqlTypes += $ this ->typesFactory ->getTypes ();
80
+
79
81
$ queryFields = ['node ' => $ this ->getNodeQueryField ()];
80
82
$ mutationFields = [];
81
83
0 commit comments