1616use ApiPlatform \Core \Exception \ResourceClassNotFoundException ;
1717use ApiPlatform \Core \GraphQl \Resolver \Factory \ResolverFactoryInterface ;
1818use ApiPlatform \Core \GraphQl \Serializer \ItemNormalizer ;
19- use ApiPlatform \Core \GraphQl \Type \Definition \IterableType ;
2019use ApiPlatform \Core \Metadata \Property \Factory \PropertyMetadataFactoryInterface ;
2120use ApiPlatform \Core \Metadata \Property \Factory \PropertyNameCollectionFactoryInterface ;
2221use ApiPlatform \Core \Metadata \Resource \Factory \ResourceMetadataFactoryInterface ;
@@ -56,10 +55,11 @@ final class SchemaBuilder implements SchemaBuilderInterface
5655 private $ itemMutationResolverFactory ;
5756 private $ defaultFieldResolver ;
5857 private $ filterLocator ;
58+ private $ typesFactory ;
5959 private $ paginationEnabled ;
6060 private $ graphqlTypes = [];
6161
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 )
6363 {
6464 $ this ->propertyNameCollectionFactory = $ propertyNameCollectionFactory ;
6565 $ this ->propertyMetadataFactory = $ propertyMetadataFactory ;
@@ -70,12 +70,14 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
7070 $ this ->itemMutationResolverFactory = $ itemMutationResolverFactory ;
7171 $ this ->defaultFieldResolver = $ defaultFieldResolver ;
7272 $ this ->filterLocator = $ filterLocator ;
73+ $ this ->typesFactory = $ typesFactory ;
7374 $ this ->paginationEnabled = $ paginationEnabled ;
7475 }
7576
7677 public function getSchema (): Schema
7778 {
78- $ this ->graphqlTypes ['Iterable ' ] = new IterableType ();
79+ $ this ->graphqlTypes += $ this ->typesFactory ->getTypes ();
80+
7981 $ queryFields = ['node ' => $ this ->getNodeQueryField ()];
8082 $ mutationFields = [];
8183
0 commit comments