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