GDS\Store::fetchPage PHP Method

fetchPage() public method

Fetch (a page of) Entities (optionally based on a GQL query)
public fetchPage ( $int_page_size, null $mix_offset = null ) : Entity[]
$int_page_size
$mix_offset null
return Entity[]
    public function fetchPage($int_page_size, $mix_offset = null)
    {
        $str_offset = '';
        $arr_params = (array) $this->arr_last_params;
        $arr_params['intPageSize'] = $int_page_size;
        if (null !== $mix_offset) {
            if (is_int($mix_offset)) {
                $str_offset = 'OFFSET @intOffset';
                $arr_params['intOffset'] = $mix_offset;
            } else {
                $str_offset = 'OFFSET @startCursor';
                $arr_params['startCursor'] = $mix_offset;
            }
        } else {
            if (strlen($this->str_last_cursor) > 1) {
                $str_offset = 'OFFSET @startCursor';
                $arr_params['startCursor'] = $this->str_last_cursor;
            }
        }
        $arr_results = $this->obj_gateway->withSchema($this->obj_schema)->withTransaction($this->str_transaction_id)->gql($this->str_last_query . " LIMIT @intPageSize {$str_offset}", $arr_params);
        $this->str_last_cursor = $this->obj_gateway->getEndCursor();
        return $arr_results;
    }