Skip to content

Commit

Permalink
Merge 4810d7f into 82ead38
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Dec 2, 2019
2 parents 82ead38 + 4810d7f commit 4ac52e2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions DependencyInjection/GraphqliteCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ public function process(ContainerBuilder $container)
$this->mapAdderToTag('graphql.field_middleware', 'addFieldMiddleware', $container, $schemaFactory);
$this->mapAdderToTag('graphql.type_mapper', 'addTypeMapper', $container, $schemaFactory);
$this->mapAdderToTag('graphql.type_mapper_factory', 'addTypeMapperFactory', $container, $schemaFactory);

// Configure cache
if (ApcuAdapter::isSupported()) {
$container->setAlias('graphqlite.cache', 'graphqlite.apcucache');
} else {
$container->setAlias('graphqlite.cache', 'graphqlite.phpfilescache');
}
}

private function registerController(string $controllerClassName, ContainerBuilder $container): void
Expand Down
22 changes: 21 additions & 1 deletion Resources/config/container/graphqlite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<defaults autowire="true" autoconfigure="true" public="false" />

<service id="TheCodingMachine\GraphQLite\SchemaFactory">
<argument index="1" type="service" id="service_container" />
<argument type="service" id="graphqlite.psr16cache" />
<argument type="service" id="service_container" />
<call method="setAuthenticationService">
<argument type="service" id="TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface" />
</call>
Expand Down Expand Up @@ -102,5 +103,24 @@
</argument>
<tag name="graphql.type_mapper_factory"/>
</service>

<service id="graphqlite.phpfilescache" class="Symfony\Component\Cache\Adapter\PhpFilesAdapter">
<argument>graphqlite</argument>
</service>

<service id="graphqlite.apcucache" class="Symfony\Component\Cache\Adapter\ApcuAdapter">
<argument>graphqlite</argument>
</service>

<service id="graphqlite.psr16cache" class="Symfony\Component\Cache\Psr16Cache">
<argument type="service" id="graphqlite.cache" />
</service>

<service id="graphqlite.cacheclearer" class="Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer">
<argument type="collection">
<argument/>
</argument>
<tag name="kernel.cache_clearer"/>
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"symfony/security-bundle": "^4.1.9 | ^5",
"symfony/yaml": "^4.1.9 | ^5",
"phpunit/phpunit": "^7.5.1",
"phpstan/phpstan": "^0.10.6",
"phpstan/phpstan-shim": "^0.11.19",
"beberlei/porpaginas": "^1.2",
"php-coveralls/php-coveralls": "^2.1.0"
},
Expand Down

0 comments on commit 4ac52e2

Please sign in to comment.