Skip to content

Commit e872858

Browse files
authored
Merge pull request #16 from moufmouf/use_graphqlite_context
Use new GraphQLite context
2 parents b565915 + ac7febe commit e872858

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Mappers/Parameters/ValidateFieldMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
use Illuminate\Validation\Factory as ValidationFactory;
4242

4343
/**
44-
* A field middleware that reads "Security" Symfony annotations.
44+
* A parameter middleware that reads "Validate" annotations.
4545
*/
4646
class ValidateFieldMiddleware implements ParameterMiddlewareInterface
4747
{

src/Providers/GraphQLiteServiceProvider.php

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

55
use Illuminate\Contracts\Auth\Access\Gate;
66
use Illuminate\Contracts\Auth\Factory as AuthFactory;
7+
use TheCodingMachine\GraphQLite\Context\Context;
78
use TheCodingMachine\GraphQLite\Exceptions\WebonyxErrorHandler;
89
use TheCodingMachine\GraphQLite\Laravel\Mappers\Parameters\ValidateFieldMiddleware;
910
use TheCodingMachine\GraphQLite\Laravel\Mappers\PaginatorTypeMapper;
@@ -63,19 +64,20 @@ public function register()
6364
return new GraphQLiteController($app[StandardServer::class], $app[HttpMessageFactoryInterface::class], $debug);
6465
});
6566

66-
$this->app->singleton(StandardServer::class, function (Application $app) {
67+
$this->app->singleton(StandardServer::class, static function (Application $app) {
6768
return new StandardServer($app[ServerConfig::class]);
6869
});
6970

70-
$this->app->singleton(ServerConfig::class, function (Application $app) {
71+
$this->app->singleton(ServerConfig::class, static function (Application $app) {
7172
$serverConfig = new ServerConfig();
7273
$serverConfig->setSchema($app[Schema::class]);
7374
$serverConfig->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']);
7475
$serverConfig->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']);
76+
$serverConfig->setContext(new Context());
7577
return $serverConfig;
7678
});
7779

78-
$this->app->singleton('graphqliteCache', function () {
80+
$this->app->singleton('graphqliteCache', static function () {
7981
if (extension_loaded('apcu') && ini_get('apc.enabled')) {
8082
return new \Symfony\Component\Cache\Simple\ApcuCache();
8183
} else {

0 commit comments

Comments
 (0)