Youshido\GraphQL\Relay\Connection\Connection::getPageInfoType PHP Method

getPageInfoType() public static method

public static getPageInfoType ( )
    public static function getPageInfoType()
    {
        return new ObjectType(['name' => 'PageInfo', 'description' => 'Information about pagination in a connection.', 'fields' => ['hasNextPage' => ['type' => new NonNullType(TypeMap::TYPE_BOOLEAN), 'description' => 'When paginating forwards, are there more items?'], 'hasPreviousPage' => ['type' => new NonNullType(TypeMap::TYPE_BOOLEAN), 'description' => 'When paginating backwards, are there more items?'], 'startCursor' => ['type' => TypeMap::TYPE_STRING, 'description' => 'When paginating backwards, the cursor to continue.'], 'endCursor' => ['type' => TypeMap::TYPE_STRING, 'description' => 'When paginating forwards, the cursor to continue.']]]);
    }

Usage Example

Esempio n. 1
0
 public function testPageInfoType()
 {
     $type = Connection::getPageInfoType();
     $this->assertEquals('PageInfo', $type->getName());
     $this->assertEquals('Information about pagination in a connection.', $type->getDescription());
     $this->assertTrue($type->hasField('hasNextPage'));
     $this->assertTrue($type->hasField('hasPreviousPage'));
     $this->assertTrue($type->hasField('startCursor'));
     $this->assertTrue($type->hasField('endCursor'));
 }