Skip to content

Commit a3d6d67

Browse files
committed
Remove addDefaultFallBackToTypeLoader
Fixes #886
1 parent b38cfbe commit a3d6d67

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

src/Definition/Type/ExtensibleSchema.php

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44

55
namespace Overblog\GraphQLBundle\Definition\Type;
66

7-
use GraphQL\Type\Definition\Type;
87
use GraphQL\Type\Schema;
98
use GraphQL\Type\SchemaConfig;
109
use Overblog\GraphQLBundle\Definition\Type\SchemaExtension\SchemaExtensionInterface;
11-
use Overblog\GraphQLBundle\Resolver\UnresolvableException;
1210

1311
class ExtensibleSchema extends Schema
1412
{
1513
public function __construct($config)
1614
{
17-
parent::__construct($this->addDefaultFallBackToTypeLoader(
15+
parent::__construct(
1816
$config instanceof SchemaConfig ? $config : SchemaConfig::create($config)
19-
));
17+
);
2018
}
2119

2220
/** @var SchemaExtensionInterface[] */
@@ -53,28 +51,4 @@ public function processExtensions()
5351

5452
return $this;
5553
}
56-
57-
private function addDefaultFallBackToTypeLoader(SchemaConfig $schemaConfig): SchemaConfig
58-
{
59-
$typeLoader = $schemaConfig->typeLoader;
60-
$loaderWrapper = null;
61-
$loaderWrapper = function ($name) use ($typeLoader, &$schemaConfig, &$loaderWrapper): ?Type {
62-
$type = null;
63-
try {
64-
$type = $typeLoader($name);
65-
} catch (UnresolvableException $e) {
66-
// second chance for types with un-registered name in TypeResolver
67-
// we disabled the custom typeLoader to force default loader usage
68-
$schemaConfig->typeLoader = null;
69-
$type = $this->getType($name);
70-
$schemaConfig->typeLoader = $loaderWrapper; // @phpstan-ignore-line
71-
}
72-
73-
return $type;
74-
};
75-
76-
$schemaConfig->typeLoader = $loaderWrapper; // @phpstan-ignore-line
77-
78-
return $schemaConfig;
79-
}
8054
}

0 commit comments

Comments
 (0)