src/GraphQl/Type/SchemaBuilder.php
private function getResourcePaginatedCollectionType(GraphQLType $resourceType): GraphQLType
    {
        $shortName = $resourceType->name;

        if (isset($this->graphqlTypes["{$shortName}Connection"])) {
            return $this->graphqlTypes["{$shortName}Connection"];
        }

        $edgeObjectTypeConfiguration = [
            'name' => "{$shortName}Edge",
            'description' => "Edge of $shortName.",
            'fields' => [
                'node' => $resourceType,
                'cursor' => GraphQLType::nonNull(GraphQLType::string()),
            ],
        ];
        $edgeObjectType = new ObjectType($edgeObjectTypeConfiguration);
        $this->graphqlTypes["{$shortName}Edge"] = $edgeObjectType;

        $pageInfoObjectTypeConfiguration = [
            'name' => "{$shortName}PageInfo",
            'description' => 'Information about the current page.',
            'fields' => [
                'endCursor' => GraphQLType::string(),
                'startCursor' => GraphQLType::string(),
                'hasNextPage' => GraphQLType::nonNull(GraphQLType::boolean()),
                'hasPreviousPage' => GraphQLType::nonNull(GraphQLType::boolean()),
            ],
        ];
        $pageInfoObjectType = new ObjectType($pageInfoObjectTypeConfiguration);
        $this->graphqlTypes["{$shortName}PageInfo"] = $pageInfoObjectType;

        $configuration = [
            'name' => "{$shortName}Connection",
            'description' => "Connection for $shortName.",
            'fields' => [
                'edges' => GraphQLType::listOf($edgeObjectType),
                'pageInfo' => GraphQLType::nonNull($pageInfoObjectType),
                'totalCount' => GraphQLType::nonNull(GraphQLType::int()),
            ],
        ];

        return $this->graphqlTypes["{$shortName}Connection"] = new ObjectType($configuration);
    }
private function getResourcePaginatedCollectionType(GraphQLType $resourceType): GraphQLType
    {
        $shortName = $resourceType->name;

        if (isset($this->graphqlTypes["{$shortName}Connection"])) {
            return $this->graphqlTypes["{$shortName}Connection"];
        }

        $edgeObjectTypeConfiguration = [
            'name' => "{$shortName}Edge",
            'description' => "Edge of $shortName.",
            'fields' => [
                'node' => $resourceType,
                'cursor' => GraphQLType::nonNull(GraphQLType::string()),
            ],
        ];
        $edgeObjectType = new ObjectType($edgeObjectTypeConfiguration);
        $this->graphqlTypes["{$shortName}Edge"] = $edgeObjectType;

        $pageInfoObjectTypeConfiguration = [
            'name' => "{$shortName}PageInfo",
            'description' => 'Information about the current page.',
            'fields' => [
                'endCursor' => GraphQLType::string(),
                'startCursor' => GraphQLType::string(),
                'hasNextPage' => GraphQLType::nonNull(GraphQLType::boolean()),
                'hasPreviousPage' => GraphQLType::nonNull(GraphQLType::boolean()),
            ],
        ];
        $pageInfoObjectType = new ObjectType($pageInfoObjectTypeConfiguration);
        $this->graphqlTypes["{$shortName}PageInfo"] = $pageInfoObjectType;

        $configuration = [
            'name' => "{$shortName}Connection",
            'description' => "Connection for $shortName.",
            'fields' => [
                'edges' => GraphQLType::listOf($edgeObjectType),
                'pageInfo' => GraphQLType::nonNull($pageInfoObjectType),
                'totalCount' => GraphQLType::nonNull(GraphQLType::int()),
            ],
        ];

        return $this->graphqlTypes["{$shortName}Connection"] = new ObjectType($configuration);
    }
private function getResourcePaginatedCollectionType ( GraphQLType $ resourceType ) : GraphQLType { $ shortName = $ resourceType -> name ; if ( isset ( $ this -> graphqlTypes [ "{$shortName}Connection" ] ) ) { return $ this -> graphqlTypes [ "{$shortName}Connection" ] ; } $ edgeObjectTypeConfiguration = [ 'name' => "{$shortName}Edge" , 'description' => "Edge of $shortName." , 'fields' => [ 'node' => $ resourceType , 'cursor' => GraphQLType :: nonNull ( GraphQLType :: string ( ) ) , ] , ] ; $ edgeObjectType = new ObjectType ( $ edgeObjectTypeConfiguration ) ; $ this -> graphqlTypes [ "{$shortName}Edge" ] = $ edgeObjectType ; $ pageInfoObjectTypeConfiguration = [ 'name' => "{$shortName}PageInfo" , 'description' => 'Information about the current page.' , 'fields' => [ 'endCursor' => GraphQLType :: string ( ) , 'startCursor' => GraphQLType :: string ( ) , 'hasNextPage' => GraphQLType :: nonNull ( GraphQLType :: boolean ( ) ) , 'hasPreviousPage' => GraphQLType :: nonNull ( GraphQLType :: boolean ( ) ) , ] , ] ; $ pageInfoObjectType = new ObjectType ( $ pageInfoObjectTypeConfiguration ) ; $ this -> graphqlTypes [ "{$shortName}PageInfo" ] = $ pageInfoObjectType ; $ configuration = [ 'name' => "{$shortName}Connection" , 'description' => "Connection for $shortName." , 'fields' => [ 'edges' => GraphQLType :: listOf ( $ edgeObjectType ) , 'pageInfo' => GraphQLType :: nonNull ( $ pageInfoObjectType ) , 'totalCount' => GraphQLType :: nonNull ( GraphQLType :: int ( ) ) , ] , ] ; return $ this -> graphqlTypes [ "{$shortName}Connection" ] = new ObjectType ( $ configuration ) ; }
Gets the type of a paginated collection of the given resource type.

@param ObjectType $resourceType

@return ObjectType
Gets the type of a paginated collection of the given resource type .