Skip to content

Commit 7e6350a

Browse files
xyngmoufmouf
authored andcommitted
fix: ensure that extended fields in MutableObjectType instances are found
1 parent 6e10dfb commit 7e6350a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Types/MutableObjectType.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace TheCodingMachine\GraphQLite\Types;
66

7+
use GraphQL\Type\Definition\FieldDefinition;
78
use GraphQL\Type\Definition\ObjectType;
89

910
/**
@@ -24,4 +25,19 @@ public function __construct(array $config, ?string $className = null)
2425
parent::__construct($config);
2526
$this->className = $className;
2627
}
28+
29+
public function findField(string $name): ?FieldDefinition
30+
{
31+
$field = parent::findField($name);
32+
if ($field) {
33+
return $field;
34+
}
35+
36+
$fields = $this->getFields();
37+
if (! isset($fields[$name])) {
38+
return null;
39+
}
40+
41+
return $fields[$name];
42+
}
2743
}

0 commit comments

Comments
 (0)