|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Symfony\Component\DependencyInjection\Loader\Configurator; |
| 4 | + |
| 5 | +return static function (ContainerConfigurator $container) { |
| 6 | + $services = $container->services(); |
| 7 | + |
| 8 | + $services->defaults() |
| 9 | + ->private() |
| 10 | + ->autowire() |
| 11 | + ->autoconfigure(); |
| 12 | + |
| 13 | + $services->set(\TheCodingMachine\GraphQLite\SchemaFactory::class) |
| 14 | + ->args( |
| 15 | + [ |
| 16 | + service('graphqlite.psr16cache'), |
| 17 | + service('service_container'), |
| 18 | + ], |
| 19 | + ) |
| 20 | + ->call( |
| 21 | + 'setAuthenticationService', |
| 22 | + [service(\TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface::class)], |
| 23 | + ) |
| 24 | + ->call( |
| 25 | + 'setAuthorizationService', |
| 26 | + [service(\TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface::class)], |
| 27 | + ); |
| 28 | + |
| 29 | + $services->set(\TheCodingMachine\GraphQLite\Schema::class) |
| 30 | + ->public() |
| 31 | + ->factory([service(\TheCodingMachine\GraphQLite\SchemaFactory::class), 'createSchema']); |
| 32 | + |
| 33 | + $services->set(\TheCodingMachine\GraphQLite\AggregateControllerQueryProviderFactory::class) |
| 34 | + ->args( |
| 35 | + [ |
| 36 | + [], |
| 37 | + service_locator([]), |
| 38 | + ], |
| 39 | + ) |
| 40 | + ->tag('graphql.queryprovider_factory'); |
| 41 | + |
| 42 | + $services->alias(\GraphQL\Type\Schema::class, \TheCodingMachine\GraphQLite\Schema::class); |
| 43 | + |
| 44 | + $services->set(\TheCodingMachine\GraphQLite\AnnotationReader::class); |
| 45 | + |
| 46 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Security\AuthenticationService::class) |
| 47 | + ->args([service('security.token_storage')->nullOnInvalid()]); |
| 48 | + |
| 49 | + $services->alias( |
| 50 | + \TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface::class, |
| 51 | + \TheCodingMachine\GraphQLite\Bundle\Security\AuthenticationService::class, |
| 52 | + ); |
| 53 | + |
| 54 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Security\AuthorizationService::class) |
| 55 | + ->args([service('security.authorization_checker')->nullOnInvalid()]); |
| 56 | + |
| 57 | + $services->alias( |
| 58 | + \TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface::class, |
| 59 | + \TheCodingMachine\GraphQLite\Bundle\Security\AuthorizationService::class, |
| 60 | + ); |
| 61 | + |
| 62 | + $services->set(\GraphQL\Server\ServerConfig::class, \TheCodingMachine\GraphQLite\Bundle\Server\ServerConfig::class) |
| 63 | + ->call('setSchema', [service(\TheCodingMachine\GraphQLite\Schema::class)]) |
| 64 | + ->call( |
| 65 | + 'setErrorFormatter', |
| 66 | + [ |
| 67 | + [ |
| 68 | + \TheCodingMachine\GraphQLite\Exceptions\WebonyxErrorHandler::class, |
| 69 | + 'errorFormatter', |
| 70 | + ], |
| 71 | + ], |
| 72 | + ) |
| 73 | + ->call( |
| 74 | + 'setErrorsHandler', |
| 75 | + [ |
| 76 | + [ |
| 77 | + \TheCodingMachine\GraphQLite\Exceptions\WebonyxErrorHandler::class, |
| 78 | + 'errorHandler', |
| 79 | + ], |
| 80 | + ], |
| 81 | + ); |
| 82 | + |
| 83 | + $services->set(\GraphQL\Validator\Rules\DisableIntrospection::class) |
| 84 | + ->args(['$enabled' => '%graphqlite.security.disableIntrospection%']); |
| 85 | + |
| 86 | + $services->set(\GraphQL\Validator\Rules\QueryComplexity::class); |
| 87 | + |
| 88 | + $services->set(\GraphQL\Validator\Rules\QueryDepth::class); |
| 89 | + |
| 90 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Controller\GraphQLiteController::class) |
| 91 | + ->public() |
| 92 | + ->tag('routing.route_loader'); |
| 93 | + |
| 94 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Mappers\RequestParameterMiddleware::class) |
| 95 | + ->tag('graphql.parameter_middleware'); |
| 96 | + |
| 97 | + $services->set(\TheCodingMachine\GraphQLite\Validator\Mappers\Parameters\AssertParameterMiddleware::class) |
| 98 | + ->args([service('validator.validator_factory')]) |
| 99 | + ->tag('graphql.parameter_middleware'); |
| 100 | + |
| 101 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Controller\GraphQL\LoginController::class) |
| 102 | + ->public() |
| 103 | + ->args(['$firewallName' => '%graphqlite.security.firewall_name%']); |
| 104 | + |
| 105 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Controller\GraphQL\MeController::class) |
| 106 | + ->public(); |
| 107 | + |
| 108 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Types\SymfonyUserInterfaceType::class) |
| 109 | + ->public(); |
| 110 | + |
| 111 | + $services->set(\TheCodingMachine\GraphQLite\Mappers\StaticClassListTypeMapperFactory::class) |
| 112 | + ->args([[]]) |
| 113 | + ->tag('graphql.type_mapper_factory'); |
| 114 | + |
| 115 | + $services->set('graphqlite.phpfilescache', \Symfony\Component\Cache\Adapter\PhpFilesAdapter::class) |
| 116 | + ->args( |
| 117 | + [ |
| 118 | + 'graphqlite', |
| 119 | + 0, |
| 120 | + '%kernel.cache_dir%', |
| 121 | + ], |
| 122 | + ); |
| 123 | + |
| 124 | + $services->set('graphqlite.apcucache', \Symfony\Component\Cache\Adapter\ApcuAdapter::class) |
| 125 | + ->args(['graphqlite']); |
| 126 | + |
| 127 | + $services->set('graphqlite.psr16cache', \Symfony\Component\Cache\Psr16Cache::class) |
| 128 | + ->args([service('graphqlite.cache')]); |
| 129 | + |
| 130 | + $services->set('graphqlite.cacheclearer', \Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer::class) |
| 131 | + ->args([[service('graphqlite.cache')]]) |
| 132 | + ->tag('kernel.cache_clearer'); |
| 133 | + |
| 134 | + $services->set(\TheCodingMachine\GraphQLite\Bundle\Command\DumpSchemaCommand::class); |
| 135 | +}; |
0 commit comments