Skip to content

Commit

Permalink
Merge pull request #2510 from dunglas/fix_2492
Browse files Browse the repository at this point in the history
GraphQL: Prevent an error when the type factory is null
  • Loading branch information
soyuka committed Feb 15, 2019
2 parents 3a82243 + cb4e16b commit d96b52a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 2.5.0 beta 1

* GraphQL: Add support for custom types

## 2.4.0 beta 1

* MongoDB: full support
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Bundle/Resources/config/graphql.xml
Expand Up @@ -63,9 +63,9 @@
<argument type="service" id="api_platform.graphql.resolver.factory.item_mutation" />
<argument type="service" id="api_platform.graphql.resolver.item" />
<argument type="service" id="api_platform.graphql.resolver.resource_field" />
<argument type="service" id="api_platform.graphql.types_factory" />
<argument type="service" id="api_platform.filter_locator" />
<argument>%api_platform.collection.pagination.enabled%</argument>
<argument type="service" id="api_platform.graphql.types_factory" />
</service>

<!-- Action -->
Expand Down
4 changes: 2 additions & 2 deletions src/GraphQl/Type/SchemaBuilder.php
Expand Up @@ -59,7 +59,7 @@ final class SchemaBuilder implements SchemaBuilderInterface
private $paginationEnabled;
private $graphqlTypes = [];

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)
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)
{
$this->propertyNameCollectionFactory = $propertyNameCollectionFactory;
$this->propertyMetadataFactory = $propertyMetadataFactory;
Expand All @@ -69,8 +69,8 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
$this->itemResolver = $itemResolver;
$this->itemMutationResolverFactory = $itemMutationResolverFactory;
$this->defaultFieldResolver = $defaultFieldResolver;
$this->filterLocator = $filterLocator;
$this->typesFactory = $typesFactory;
$this->filterLocator = $filterLocator;
$this->paginationEnabled = $paginationEnabled;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/GraphQl/Type/SchemaBuilderTest.php
Expand Up @@ -309,9 +309,9 @@ function () {
},
function () {
},
$typesFactoryProphecy->reveal(),
null,
$paginationEnabled,
$typesFactoryProphecy->reveal()
$paginationEnabled
);
}
}

0 comments on commit d96b52a

Please sign in to comment.