Skip to content

Pagination helper - backward count does not work with promises #286

@akomm

Description

@akomm
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Version/Branch dev-master

Paginator $count callback does work with promise when using forward, but not backward. In case of backward, you get:

Object of class GraphQL\\Executor\\Promise\\Promise could not be converted to int

Example code:

$paginator = new Paginator(function($offset, $limit) {
    return $this->someLoader->load(new SomeKey($criteria, $offset, $limit))->then(function(array $ids) {
        return $this->someOtherLoader->loadMany($ids);
    });
});
$paginator->auto($args, function() {
    return $this->someLoader->load(new SomeKey($criteria))->then(FnUtils::arrayLikeCount());
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions