diff --git a/composer.json b/composer.json index a06b68d..c652949 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,11 @@ "name": "linkorb/graphael", "description": "Graphael: GraphQL Server builder", "homepage": "http://www.github.com/linkorb/graphael", - "keywords": ["graphael", "graphql", "linkorb"], + "keywords": [ + "graphael", + "graphql", + "linkorb" + ], "type": "application", "authors": [ { @@ -13,20 +17,20 @@ ], "require": { "php": ">=7.2", - "symfony/options-resolver": "~3.0", - "symfony/dependency-injection": "~3.3", - "webonyx/graphql-php": "^0.13.8", - "linkorb/connector": "~1.0", + "symfony/options-resolver": "^5.0 || ^6.0", + "symfony/dependency-injection": " ^5.0 || ^6.0", + "webonyx/graphql-php": "^14.0.0", + "linkorb/connector": "^1.0", "firebase/php-jwt": "~5.0", "pwa/time-elapsed": "^1.0", - "symfony/security-core": "^4.2 || ^5.0 ", - "symfony/http-foundation": "^4.2 || ^5.0", + "symfony/security-core": "^6.0", + "symfony/http-foundation": " ^5.0 || ^6.0", "ext-pdo": "*", - "doctrine/cache": "^1.10" + "doctrine/cache": "^2.0" }, "autoload": { "psr-4": { - "Graphael\\": "src/" + "Graphael\\": "src/" } }, "license": "MIT" diff --git a/src/Server.php b/src/Server.php index 848f353..8d58677 100644 --- a/src/Server.php +++ b/src/Server.php @@ -3,10 +3,10 @@ namespace Graphael; use Graphael\Services\FieldResolver; +use GraphQL\Error\DebugFlag; use GraphQL\Server\StandardServer; use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Schema; -use GraphQL\Error\Debug; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; class Server extends StandardServer @@ -23,8 +23,7 @@ public function __construct( AuthorizationCheckerInterface $authorizationChecker, string $adminRole, $request - ) - { + ) { $schema = new Schema( [ 'query' => $queryType, @@ -35,7 +34,7 @@ public function __construct( $config = [ 'schema' => $schema, - 'debug' => Debug::INCLUDE_DEBUG_MESSAGE | Debug::INCLUDE_TRACE, + 'debugFlag' => DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE, 'rootValue' => $rootValue, 'fieldResolver' => [new FieldResolver(), 'resolve'], 'context' => [ @@ -45,7 +44,6 @@ public function __construct( ], ]; - parent::__construct($config); } } diff --git a/src/Services/DependencyInjection/ContainerFactory.php b/src/Services/DependencyInjection/ContainerFactory.php index 5169b90..6a8935e 100644 --- a/src/Services/DependencyInjection/ContainerFactory.php +++ b/src/Services/DependencyInjection/ContainerFactory.php @@ -2,6 +2,7 @@ namespace Graphael\Services\DependencyInjection; +use Connector\Connector; use Graphael\Security\Authorization\UsernameVoter; use Graphael\Security\JwtCertManager\JwtCertManager; use Graphael\Security\JwtCertManager\JwtCertManagerInterface; @@ -14,15 +15,10 @@ use Graphael\Server; use Graphael\Services\Error\ErrorHandler; use Graphael\Services\Error\ErrorHandlerInterface; -use PDO; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; -use Connector\Connector; -use ReflectionClass; -use RuntimeException; -use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; @@ -174,9 +170,10 @@ private static function registerSecurityServices(ContainerBuilder $container, ar ->setPublic(true); $authenticationManager = $container->register( - AuthenticationManagerInterface::class, - AuthenticationProviderManager::class + AuthenticationTrustResolverInterface::class, + AuthenticationTrustResolver::class ); + $authenticationManager->addArgument([new Reference(JwtAuthProvider::class)]); $container->register(AccessDecisionManagerInterface::class, AccessDecisionManager::class) @@ -269,8 +266,13 @@ private static function autoRegisterClass(ContainerBuilder $container, $classNam $reflectionClass = new ReflectionClass($className); $constructor = $reflectionClass->getConstructor(); $definition = $container->register($className, $className); + foreach ($constructor->getParameters() as $p) { - $reflectionClass = $p->getClass(); + // $reflectionClass = $p->getClass(); + + $reflectionClass = $p->getType() && !$p->getType()->isBuiltin() + ? new \ReflectionClass($p->getType()->getName()) + : null; if ($reflectionClass) { $definition->addArgument(new Reference($reflectionClass->getName())); }