22
33namespace Overblog \GraphQLBundle \DependencyInjection \Compiler ;
44
5+ use GraphQL \Type \Definition \Type ;
56use Overblog \GraphQLBundle \Definition \Resolver \AliasedInterface ;
7+ use Overblog \GraphQLBundle \Definition \Resolver \MutationInterface ;
8+ use Overblog \GraphQLBundle \Definition \Resolver \ResolverInterface ;
69use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
710use Symfony \Component \DependencyInjection \ContainerBuilder ;
811use Symfony \Component \DependencyInjection \Definition ;
912
1013final class AliasedPass implements CompilerPassInterface
1114{
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+
1221 /**
1322 * {@inheritdoc}
1423 */
@@ -28,7 +37,7 @@ public function process(ContainerBuilder $container)
2837 private function filterDefinitions ($ definitions )
2938 {
3039 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 ) {
3241 if ($ definition ->hasTag ($ tagName )) {
3342 return is_subclass_of ($ definition ->getClass (), AliasedInterface::class);
3443 }
@@ -55,7 +64,7 @@ private function addDefinitionTagsFromAliases(Definition $definition)
5564 private function guessTagName (Definition $ definition )
5665 {
5766 $ tagName = null ;
58- foreach (AutoMappingPass ::SERVICE_SUBCLASS_TAG_MAPPING as $ refClassName => $ tag ) {
67+ foreach (self ::SERVICE_SUBCLASS_TAG_MAPPING as $ refClassName => $ tag ) {
5968 if (is_subclass_of ($ definition ->getClass (), $ refClassName )) {
6069 $ tagName = $ tag ;
6170 break ;
0 commit comments