Skip to content

Commit

Permalink
Adaptation nuwave/lighthouse v5
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbrzzl committed Feb 22, 2021
1 parent b43f069 commit 7a6405a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
}
],
"require": {
"php": ">=7.1.0",
"illuminate/support": "5.*|6.*|7.*"
"php": ">=7.2",
"illuminate/support": "5.8|6.*|7.*|8.*"
},
"require-dev": {
"composer/composer": "^1.7",
"mockery/mockery": "~1.0",
"nuwave/lighthouse": "~4.0",
"nuwave/lighthouse": "~5.0",
"orchestra/database": "3.5.*|3.6.*|3.7.*@dev",
"orchestra/testbench": "3.5.*|3.6.*|3.7.*",
"phpunit/phpunit": "~7.0"
Expand Down
2 changes: 1 addition & 1 deletion src/ConditionsGeneratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected function handlePaginate()
$orders = [];
foreach ($sorts as $sort) {
if (is_string($sort)) {
if (! starts_with($sort, ['+', '-'])) {
if (! \Str::startsWith($sort, ['+', '-'])) {
continue;
}
$field = substr($sort, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/Lighthouse/Directives/GetlistDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Nuwave\Lighthouse\Support\Contracts\FieldManipulator;
use MatrixLab\LaravelAdvancedSearch\ConditionsGeneratorTrait;

class GetlistDirective extends BaseDirective implements FieldResolver, FieldManipulator, DefinedDirective
class GetlistDirective extends BaseDirective implements FieldResolver, FieldManipulator
{

use ConditionsGeneratorTrait;
Expand Down
12 changes: 6 additions & 6 deletions src/Lighthouse/Directives/PaginationManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace MatrixLab\LaravelAdvancedSearch\Lighthouse\Directives;

use \GraphQL\Language\Parser;
use Nuwave\Lighthouse\Schema\AST\ASTHelper;
use GraphQL\Language\AST\FieldDefinitionNode;
use Nuwave\Lighthouse\Schema\AST\DocumentAST;
use Nuwave\Lighthouse\Schema\AST\PartialParser;
use GraphQL\Language\AST\ObjectTypeDefinitionNode;
use Nuwave\Lighthouse\Exceptions\DirectiveException;
use MatrixLab\LaravelAdvancedSearch\Lighthouse\Types\PaginatorField;
Expand Down Expand Up @@ -54,15 +54,15 @@ public static function registerPaginator(FieldDefinitionNode $fieldDefinition, O
$paginatorFieldClassName = addslashes(PaginatorField::class);

// register paginator.
$paginatorType = PartialParser::objectTypeDefinition("
$paginatorType = Parser::objectTypeDefinition("
type $paginatorTypeName {
items: [$fieldTypeName] @field(resolver: \"{$paginatorFieldClassName}@dataResolver\")
cursor: PaginationCursor! @field(resolver: \"{$paginatorFieldClassName}@paginatorInfoResolver\")
}
");

// register Pagination Cursor object.
$paginationCursor = PartialParser::objectTypeDefinition('
$paginationCursor = Parser::objectTypeDefinition('
"""Paginator input type"""
type PaginationCursor {
total: Int!
Expand All @@ -73,7 +73,7 @@ public static function registerPaginator(FieldDefinitionNode $fieldDefinition, O
');

// register Paginator Input object.
$paginatorInput = PartialParser::inputObjectTypeDefinition('
$paginatorInput = Parser::inputObjectTypeDefinition('
"""Paginator input type"""
input PaginatorInput {
"""Display a specific page"""
Expand All @@ -87,8 +87,8 @@ public static function registerPaginator(FieldDefinitionNode $fieldDefinition, O
}
');

$fieldDefinition->type = PartialParser::namedType($paginatorTypeName);
$parentType->fields = ASTHelper::mergeNodeList($parentType->fields, [$fieldDefinition]);
$fieldDefinition->type = Parser::namedType($paginatorTypeName);
$parentType->fields = ASTHelper::mergeNodeList($parentType->fields, [$fieldDefinition], true);

$documentAST->setTypeDefinition($paginatorType);
$documentAST->setTypeDefinition($parentType);
Expand Down

0 comments on commit 7a6405a

Please sign in to comment.