Skip to content

Commit

Permalink
Extract repose method
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosen committed Aug 19, 2024
1 parent b7aace2 commit 086313e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ protected function resolve(
$cacheContext
);

return $this->classResolver
->getInstanceFromDefinition(SearchApiResponse::class)
->setQuery($query);
return $this->searchApiResponse($query);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase;
use Drupal\search_api\Entity\Index;
use Drupal\search_api\Query\QueryInterface;
use Drupal\thunder_gqls\Wrappers\SearchApiResponse;
use GraphQL\Error\UserError;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -167,4 +168,19 @@ protected function buildBaseQuery(
return $query;
}

/**
* The search api response.
*
* @param \Drupal\search_api\Query\QueryInterface $query
* The search api query.
*
* @return \Drupal\thunder_gqls\Wrappers\SearchApiResponse
* The search api response.
*/
protected function searchApiResponse(QueryInterface $query): SearchApiResponse {
return $this->classResolver
->getInstanceFromDefinition(SearchApiResponse::class)
->setQuery($query);
}

}

0 comments on commit 086313e

Please sign in to comment.