|
1
|
|
|
<?php |
|
2
|
|
|
/******************************************************************************* |
|
3
|
|
|
* This file is part of the GraphQL Bundle package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) YnloUltratech <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
******************************************************************************/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Ynlo\GraphQLBundle; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
14
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
|
15
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
16
|
|
|
use Ynlo\GraphQLBundle\Component\TaggedServices\TaggedServicesCompilerPass; |
|
17
|
|
|
use Ynlo\GraphQLBundle\DependencyInjection\Compiler\ControllerPass; |
|
18
|
|
|
use Ynlo\GraphQLBundle\DependencyInjection\YnloGraphQLExtension; |
|
19
|
|
|
use Ynlo\GraphQLBundle\Encoder\IDEncoderManager; |
|
20
|
|
|
use Ynlo\GraphQLBundle\Error\Exporter\ErrorListExporterInterface; |
|
21
|
|
|
use Ynlo\GraphQLBundle\Extension\ExtensionInterface; |
|
22
|
|
|
use Ynlo\GraphQLBundle\Filter\FilterInterface; |
|
23
|
|
|
use Ynlo\GraphQLBundle\Filter\FilterResolverInterface; |
|
24
|
|
|
use Ynlo\GraphQLBundle\Form\Input\InputFieldTypeGuesser; |
|
25
|
|
|
use Ynlo\GraphQLBundle\SearchBy\SearchByInterface; |
|
26
|
|
|
use Ynlo\GraphQLBundle\Subscription\Publisher; |
|
27
|
|
|
use Ynlo\GraphQLBundle\Subscription\SubscriptionAwareInterface; |
|
28
|
|
|
use Ynlo\GraphQLBundle\Type\Loader\TypeAutoLoader; |
|
29
|
|
|
use Ynlo\GraphQLBundle\Type\Registry\TypeRegistry; |
|
30
|
|
|
use Ynlo\GraphQLBundle\Util\IDEncoder; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Class YnloGraphQLBundle |
|
34
|
|
|
*/ |
|
35
|
|
|
class YnloGraphQLBundle extends Bundle |
|
36
|
|
|
{ |
|
37
|
|
|
/** |
|
38
|
|
|
* {@inheritDoc} |
|
39
|
|
|
*/ |
|
40
|
|
|
public function boot() |
|
41
|
|
|
{ |
|
42
|
|
|
TypeRegistry::clear(); //required for tests |
|
43
|
|
|
|
|
44
|
|
|
$this->container->get(TypeAutoLoader::class)->autoloadTypes(); |
|
45
|
|
|
|
|
46
|
|
|
//setup the encoder to use statically |
|
47
|
|
|
IDEncoder::setup($this->container->get(IDEncoderManager::class)->getEncoder()); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* {@inheritDoc} |
|
52
|
|
|
*/ |
|
53
|
|
|
public function build(ContainerBuilder $container) |
|
54
|
|
|
{ |
|
55
|
|
|
$container->addCompilerPass(new TaggedServicesCompilerPass()); |
|
|
|
|
|
|
56
|
|
|
$container->addCompilerPass(new ControllerPass()); |
|
57
|
|
|
$container->registerForAutoconfiguration(ErrorListExporterInterface::class)->addTag('graphql.error_list_exporter'); |
|
58
|
|
|
$container->registerForAutoconfiguration(ExtensionInterface::class)->addTag('graphql.extension'); |
|
59
|
|
|
$container->registerForAutoconfiguration(InputFieldTypeGuesser::class)->addTag('graphql.input_type_guesser'); |
|
60
|
|
|
$container->registerForAutoconfiguration(FilterResolverInterface::class)->addTag('graphql.filter_resolver'); |
|
61
|
|
|
$container->registerForAutoconfiguration(SearchByInterface::class) |
|
62
|
|
|
->addTag('graphql.list_search') |
|
63
|
|
|
->setPublic(true); |
|
64
|
|
|
$container->registerForAutoconfiguration(FilterInterface::class) |
|
65
|
|
|
->addTag('graphql.list_filter') |
|
66
|
|
|
->setPublic(true); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* {@inheritDoc} |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getContainerExtension() |
|
73
|
|
|
{ |
|
74
|
|
|
return new YnloGraphQLExtension(); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|