Skip to content

Commit 9e14ac4

Browse files
committed
Making code compatible with Symfony 5 cache
1 parent e872858 commit 9e14ac4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"illuminate/support": "^5.7|^6.0",
2424
"illuminate/cache": "^5.7|^6.0",
2525
"symfony/psr-http-message-bridge": "^1",
26-
"zendframework/zend-diactoros": "^1.8.6"
26+
"zendframework/zend-diactoros": "^1.8.6",
27+
"symfony/cache": "^4.3 || ^5"
2728
},
2829
"require-dev": {
2930
"orchestra/testbench": "^3.7.7 || ^4",

src/Providers/GraphQLiteServiceProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Illuminate\Contracts\Auth\Access\Gate;
66
use Illuminate\Contracts\Auth\Factory as AuthFactory;
7+
use Symfony\Component\Cache\Adapter\ApcuAdapter;
8+
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
9+
use Symfony\Component\Cache\Psr16Cache;
710
use TheCodingMachine\GraphQLite\Context\Context;
811
use TheCodingMachine\GraphQLite\Exceptions\WebonyxErrorHandler;
912
use TheCodingMachine\GraphQLite\Laravel\Mappers\Parameters\ValidateFieldMiddleware;
@@ -79,9 +82,9 @@ public function register()
7982

8083
$this->app->singleton('graphqliteCache', static function () {
8184
if (extension_loaded('apcu') && ini_get('apc.enabled')) {
82-
return new \Symfony\Component\Cache\Simple\ApcuCache();
85+
return new Psr16Cache(new ApcuAdapter());
8386
} else {
84-
return new \Symfony\Component\Cache\Simple\PhpFilesCache();
87+
return new Psr16Cache(new PhpFilesAdapter());
8588
}
8689
});
8790

0 commit comments

Comments
 (0)