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

Open in your IDE?
  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\TypeGeneratorPass;
  13. use Overblog\GraphQLBundle\DependencyInjection\Compiler\TypeTaggedServiceMappingPass;
  14. use Overblog\GraphQLBundle\DependencyInjection\OverblogGraphQLExtension;
  15. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  16. use Symfony\Component\DependencyInjection\ContainerBuilder;
  17. use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
  18. use Symfony\Component\HttpKernel\Bundle\Bundle;
  19. final class OverblogGraphQLBundle extends Bundle
  20. {
  21. public function boot(): void
  22. {
  23. if ($this->container->has('overblog_graphql.cache_compiler')) {
  24. $this->container->get('overblog_graphql.cache_compiler')->loadClasses(); // @phpstan-ignore-line
  25. }
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function build(ContainerBuilder $container): void
  31. {
  32. parent::build($container);
  33. // TypeGeneratorPass must be before TypeTaggedServiceMappingPass
  34. $container->addCompilerPass(new ConfigParserPass());
  35. $container->addCompilerPass(new GraphQLServicesPass());
  36. $container->addCompilerPass(new ExpressionFunctionPass());
  37. $container->addCompilerPass(new ResolverMethodAliasesPass());
  38. $container->addCompilerPass(new AliasedPass());
  39. $container->addCompilerPass(new ResolverMapTaggedServiceMappingPass());
  40. $container->addCompilerPass(new TypeGeneratorPass(), PassConfig::TYPE_BEFORE_REMOVING);
  41. $container->addCompilerPass(new TypeTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
  42. $container->addCompilerPass(new QueryTaggedServiceMappingPass(), PassConfig::TYPE_BEFORE_REMOVING);
  43. $container->addCompilerPass(new MutationTaggedServiceMappingTaggedPass(), PassConfig::TYPE_BEFORE_REMOVING);
  44. }
  45. public function getContainerExtension(): ?ExtensionInterface
  46. {
  47. if (!$this->extension instanceof ExtensionInterface) {
  48. $this->extension = new OverblogGraphQLExtension();
  49. }
  50. return $this->extension;
  51. }
  52. }