Skip to content

Commit d96b52a

Browse files
authored
Merge pull request #2510 from dunglas/fix_2492
GraphQL: Prevent an error when the type factory is null
2 parents 3a82243 + cb4e16b commit d96b52a

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.5.0 beta 1
4+
5+
* GraphQL: Add support for custom types
6+
37
## 2.4.0 beta 1
48

59
* MongoDB: full support

src/Bridge/Symfony/Bundle/Resources/config/graphql.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
<argument type="service" id="api_platform.graphql.resolver.factory.item_mutation" />
6464
<argument type="service" id="api_platform.graphql.resolver.item" />
6565
<argument type="service" id="api_platform.graphql.resolver.resource_field" />
66+
<argument type="service" id="api_platform.graphql.types_factory" />
6667
<argument type="service" id="api_platform.filter_locator" />
6768
<argument>%api_platform.collection.pagination.enabled%</argument>
68-
<argument type="service" id="api_platform.graphql.types_factory" />
6969
</service>
7070

7171
<!-- Action -->

src/GraphQl/Type/SchemaBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final class SchemaBuilder implements SchemaBuilderInterface
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, TypesFactoryInterface $typesFactory = null)
62+
public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, ResourceMetadataFactoryInterface $resourceMetadataFactory, ResolverFactoryInterface $collectionResolverFactory, ResolverFactoryInterface $itemMutationResolverFactory, callable $itemResolver, callable $defaultFieldResolver, TypesFactoryInterface $typesFactory, ContainerInterface $filterLocator = null, bool $paginationEnabled = true)
6363
{
6464
$this->propertyNameCollectionFactory = $propertyNameCollectionFactory;
6565
$this->propertyMetadataFactory = $propertyMetadataFactory;
@@ -69,8 +69,8 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
6969
$this->itemResolver = $itemResolver;
7070
$this->itemMutationResolverFactory = $itemMutationResolverFactory;
7171
$this->defaultFieldResolver = $defaultFieldResolver;
72-
$this->filterLocator = $filterLocator;
7372
$this->typesFactory = $typesFactory;
73+
$this->filterLocator = $filterLocator;
7474
$this->paginationEnabled = $paginationEnabled;
7575
}
7676

tests/GraphQl/Type/SchemaBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ function () {
309309
},
310310
function () {
311311
},
312+
$typesFactoryProphecy->reveal(),
312313
null,
313-
$paginationEnabled,
314-
$typesFactoryProphecy->reveal()
314+
$paginationEnabled
315315
);
316316
}
317317
}

0 commit comments

Comments
 (0)