EntityQueryMapQueryProvider.php in GraphQL 8.3
File
src/GraphQL/QueryProvider/EntityQueryMapQueryProvider.php
View source
<?php
namespace Drupal\graphql\GraphQL\QueryProvider;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use GraphQL\Server\OperationParams;
class EntityQueryMapQueryProvider implements QueryProviderInterface {
protected $entityTypeManager;
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
}
public function getQuery($id, OperationParams $operation) {
list($version, $id) = explode(':', $id);
if (empty($version) || empty($id)) {
return NULL;
}
$storage = $this->entityTypeManager
->getStorage('graphql_query_map');
if ($map = $storage
->load($version)) {
return $map
->getQuery($id);
}
return NULL;
}
}