vendor/overblog/graphql-bundle/src/Definition/GraphQLServices.php line 39

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Overblog\GraphQLBundle\Definition;
  4. use GraphQL\Type\Definition\ResolveInfo;
  5. use GraphQL\Type\Definition\Type;
  6. use Overblog\GraphQLBundle\Validator\InputValidator;
  7. use Symfony\Component\DependencyInjection\ServiceLocator;
  8. /**
  9. * Container for special services to be passed to all generated types.
  10. */
  11. final class GraphQLServices extends ServiceLocator
  12. {
  13. /**
  14. * @param mixed ...$args
  15. *
  16. * @return mixed
  17. */
  18. public function query(string $alias, ...$args)
  19. {
  20. return $this->get('queryResolver')->resolve([$alias, $args]);
  21. }
  22. /**
  23. * @param mixed ...$args
  24. *
  25. * @return mixed
  26. */
  27. public function mutation(string $alias, ...$args)
  28. {
  29. return $this->get('mutationResolver')->resolve([$alias, $args]);
  30. }
  31. public function getType(string $typeName): ?Type
  32. {
  33. return $this->get('typeResolver')->resolve($typeName);
  34. }
  35. /**
  36. * Creates an instance of InputValidator
  37. *
  38. * @param mixed $value
  39. * @param mixed $context
  40. */
  41. public function createInputValidator($value, ArgumentInterface $args, $context, ResolveInfo $info): InputValidator
  42. {
  43. return $this->get('input_validator_factory')->create(
  44. new ResolverArgs($value, $args, $context, $info)
  45. );
  46. }
  47. }