vendor/overblog/graphql-bundle/src/OverblogGraphQLBundle.php line 36

  1. <?php
  2. declare(strict_types=1);
  3. namespace Overblog\GraphQLBundle;
  4. use Overblog\GraphQLBundle\DependencyInjection\Compiler\AliasedPass;
  5. use Overblog\GraphQLBundle\DependencyInjection\Compiler\ConfigParserPass;
  6. use Overblog\GraphQLBundle\DependencyInjection\Compiler\ExpressionFunctionPass;
  7. use Overblog\GraphQLBundle\DependencyInjection\Compiler\GraphQLServicesPass;
  8. use Overblog\GraphQLBundle\DependencyInjection\Compiler\MutationTaggedServiceMappingTaggedPass;
  9. use Overblog\GraphQLBundle\DependencyInjection\Compiler\QueryTaggedServiceMappingPass;
  10. use Overblog\GraphQLBundle\DependencyInjection\Compiler\ResolverMapTaggedServiceMappingPass;
  11. use Overblog\GraphQLBundle\DependencyInjection\Compiler\ResolverMethodAliasesPass;
  12. use Overblog\GraphQLBundle\DependencyInjection\Compiler\ResolverTaggedServiceMappingPass;
  13. use Overblog\GraphQLBundle\DependencyInjection\Compiler\TypeGeneratorPass;
  14. use Overblog\GraphQLBundle\DependencyInjection\Compiler\TypeTaggedServiceMappingPass;
  15. use Overblog\GraphQLBundle\DependencyInjection\OverblogGraphQLExtension;
  16. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  17. use Symfony\Component\DependencyInjection\ContainerBuilder;
  18. use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
  19. use Symfony\Component\HttpKernel\Bundle\Bundle;
  20. class OverblogGraphQLBundle extends Bundle
  21. {
  22.     public function boot(): void
  23.     {
  24.         if ($this->container->has('overblog_graphql.cache_compiler')) {
  25.             $this->container->get('overblog_graphql.cache_compiler')->loadClasses(); // @phpstan-ignore-line
  26.         }
  27.     }
  28.     /**
  29.      * {@inheritdoc}
  30.      */
  31.     public function build(ContainerBuilder $container): void
  32.     {
  33.         parent::build($container);
  34.         //TypeGeneratorPass must be before TypeTaggedServiceMappingPass
  35.         $container->addCompilerPass(new ConfigParserPass());
  36.         $container->addCompilerPass(new GraphQLServicesPass());
  37.         $container->addCompilerPass(new ExpressionFunctionPass());
  38.         $container->addCompilerPass(new ResolverMethodAliasesPass());
  39.         $container->addCompilerPass(new AliasedPass());
  40.         $container->addCompilerPass(new ResolverMapTaggedServiceMappingPass());
  41.         $container->addCompilerPass(new TypeGeneratorPass(), PassConfig::TYPE_BEFORE_REMOVING);
  42.         $container->addCompilerPass(new TypeTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
  43.         $container->addCompilerPass(new QueryTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
  44.         $container->addCompilerPass(new MutationTaggedServiceMappingTaggedPass(), PassConfig::TYPE_BEFORE_REMOVING);
  45.         // TODO: remove next line in 1.0
  46.         $container->addCompilerPass(new ResolverTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
  47.     }
  48.     public function getContainerExtension(): ?ExtensionInterface
  49.     {
  50.         if (!$this->extension instanceof ExtensionInterface) {
  51.             $this->extension = new OverblogGraphQLExtension();
  52.         }
  53.         return $this->extension;
  54.     }
  55. }