2
2
3
3
namespace Overblog \GraphQLBundle \DependencyInjection \Compiler ;
4
4
5
+ use GraphQL \Type \Definition \Type ;
5
6
use Overblog \GraphQLBundle \Definition \Resolver \AliasedInterface ;
7
+ use Overblog \GraphQLBundle \Definition \Resolver \MutationInterface ;
8
+ use Overblog \GraphQLBundle \Definition \Resolver \ResolverInterface ;
6
9
use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
7
10
use Symfony \Component \DependencyInjection \ContainerBuilder ;
8
11
use Symfony \Component \DependencyInjection \Definition ;
9
12
10
13
final class AliasedPass implements CompilerPassInterface
11
14
{
15
+ private const SERVICE_SUBCLASS_TAG_MAPPING = [
16
+ MutationInterface::class => 'overblog_graphql.mutation ' ,
17
+ ResolverInterface::class => 'overblog_graphql.resolver ' ,
18
+ Type::class => TypeTaggedServiceMappingPass::TAG_NAME ,
19
+ ];
20
+
12
21
/**
13
22
* {@inheritdoc}
14
23
*/
@@ -28,7 +37,7 @@ public function process(ContainerBuilder $container)
28
37
private function filterDefinitions ($ definitions )
29
38
{
30
39
return array_filter ($ definitions , function (Definition $ definition ) {
31
- foreach (AutoMappingPass ::SERVICE_SUBCLASS_TAG_MAPPING as $ tagName ) {
40
+ foreach (self ::SERVICE_SUBCLASS_TAG_MAPPING as $ tagName ) {
32
41
if ($ definition ->hasTag ($ tagName )) {
33
42
return is_subclass_of ($ definition ->getClass (), AliasedInterface::class);
34
43
}
@@ -55,7 +64,7 @@ private function addDefinitionTagsFromAliases(Definition $definition)
55
64
private function guessTagName (Definition $ definition )
56
65
{
57
66
$ tagName = null ;
58
- foreach (AutoMappingPass ::SERVICE_SUBCLASS_TAG_MAPPING as $ refClassName => $ tag ) {
67
+ foreach (self ::SERVICE_SUBCLASS_TAG_MAPPING as $ refClassName => $ tag ) {
59
68
if (is_subclass_of ($ definition ->getClass (), $ refClassName )) {
60
69
$ tagName = $ tag ;
61
70
break ;
0 commit comments