Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -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"
Expand Down
8 changes: 3 additions & 5 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,8 +23,7 @@ public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
string $adminRole,
$request
)
{
) {
$schema = new Schema(
[
'query' => $queryType,
Expand All @@ -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' => [
Expand All @@ -45,7 +44,6 @@ public function __construct(
],
];


parent::__construct($config);
}
}
22 changes: 12 additions & 10 deletions src/Services/DependencyInjection/ContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()));
}
Expand Down