Skip to content

Try GraphQL v5 #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 7.4.x
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"drupal/focal_point": "^2.1.2",
"drupal/facets": "^2.0.6",
"drupal/gin": "^4.0",
"drupal/graphql": "^4.7",
"drupal/graphql": "^5.0-alpha1",
"drupal/inline_entity_form": "^1.0-rc14",
"drupal/ivw_integration": "^2.0",
"drupal/length_indicator": "^1.2",
Expand Down Expand Up @@ -111,7 +111,6 @@
"npm-asset/slick-carousel": "^1.8",
"npm-asset/select2": "^4.0.7",
"caxy/php-htmldiff": "^0.1.14",
"webonyx/graphql-php": "^14.11.8",
"drupal/jquery_ui": "^1.6",
"drupal/jquery_ui_draggable": "^2.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public function add($index, $id) {
/**
* {@inheritdoc}
*/
protected function getBufferId($item) {
protected function getBufferId(\ArrayObject $item): string {
return $item['index'];
}

/**
* {@inheritdoc}
*/
public function resolveBufferArray(array $buffer) {
protected function resolveBufferArray(array $buffer): array {
$index = reset($buffer)['index'];
$ids = array_map(function (\ArrayObject $item) {
return (array) $item['id'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function resolveField(FieldContext $fieldContext) {
public function resolveField(FieldContext $field): mixed {
$contextValues = $this->getContextValues();

if (!isset($contextValues['path'])) {
throw new \LogicException('Missing required path argument.');
}

$url = $this->currentRequest->getSchemeAndHttpHost() . $contextValues['path'];
$request = $this->createRequest($this->currentRequest, $url, $fieldContext);
$request = $this->createRequest($this->currentRequest, $url, $field);

$response = $this->httpKernel->handle($request, HttpKernelInterface::SUB_REQUEST);
if ($response instanceof SubRequestResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Drupal\Core\Render\Element;
use Drupal\Core\Url;
use Drupal\graphql\GraphQL\ResolverRegistry;
use Drupal\graphql\GraphQL\ResolverRegistryInterface;
use Drupal\graphql\Plugin\DataProducerPluginManager;
use Drupal\graphql\Plugin\GraphQL\Schema\ComposableSchema;
use Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase;
Expand Down Expand Up @@ -60,7 +59,7 @@ protected function setDataProducerManager(DataProducerPluginManager $pluginManag
/**
* {@inheritdoc}
*/
public function getResolverRegistry(): ResolverRegistryInterface {
public function getResolverRegistry(): ResolverRegistry {
$this->registry = new ResolverRegistry();
$this->createResolverBuilder();

Expand Down
7 changes: 4 additions & 3 deletions modules/thunder_gqls/src/Traits/ResolverHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\graphql\GraphQL\Resolver\ResolverInterface;
use Drupal\graphql\GraphQL\ResolverBuilder;
use Drupal\graphql\GraphQL\ResolverRegistry;
use Drupal\graphql\GraphQL\ResolverRegistryInterface;

/**
Expand All @@ -19,11 +20,11 @@ trait ResolverHelperTrait {
protected ResolverBuilder $builder;

/**
* ResolverRegistryInterface.
* ResolverRegistry.
*
* @var \Drupal\graphql\GraphQL\ResolverRegistryInterface
* @var \Drupal\graphql\GraphQL\ResolverRegistry
*/
protected ResolverRegistryInterface $registry;
protected ResolverRegistry $registry;

/**
* Add field resolver to registry, if it does not already exist.
Expand Down
Loading