Skip to content

Commit c5eb2ca

Browse files
committed
Make ObjectNode.php config parsing better overridable.
1 parent ea13b32 commit c5eb2ca

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Config/Parser/GraphQL/ASTConverter/ObjectNode.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@
55
namespace Overblog\GraphQLBundle\Config\Parser\GraphQL\ASTConverter;
66

77
use GraphQL\Language\AST\Node;
8+
use GraphQL\Language\AST\ObjectTypeDefinitionNode;
89

910
class ObjectNode implements NodeInterface
1011
{
1112
protected const TYPENAME = 'object';
1213

1314
public static function toConfig(Node $node): array
15+
{
16+
return [
17+
'type' => static::TYPENAME,
18+
'config' => static::parseConfig($node),
19+
];
20+
}
21+
22+
/**
23+
* @param ObjectTypeDefinitionNode $node
24+
*
25+
* @return array<string,mixed>
26+
*/
27+
protected static function parseConfig(Node $node): array
1428
{
1529
$config = DescriptionNode::toConfig($node) + [
1630
'fields' => FieldsNode::toConfig($node),
@@ -24,9 +38,6 @@ public static function toConfig(Node $node): array
2438
$config['interfaces'] = $interfaces;
2539
}
2640

27-
return [
28-
'type' => static::TYPENAME,
29-
'config' => $config,
30-
];
41+
return $config;
3142
}
3243
}

0 commit comments

Comments
 (0)