class result implements result_interface

internal  
 

Immutable result container returned by the Query Engine.

Contains:

  • resolved dataset (Domain[] or stdClass[])
  • total record count (ignoring pagination)
  • pagination data

Methods

__construct(array $items, int $total, int|null $page, int|null $per_page, bool $is_std_class)

No description

array
items()

No description

int
total()

Returns total number of items matching the query, ignoring pagination.

bool
is_std_class()

Indicates whether the items are stdClass objects instead of Domain objects.

bool
is_paginated()

Indicates whether the result is paginated.

int|null
page()

Returns current page number.

int|null
perpage()

Returns number of items per page.

int
pages()

Returns total number of pages.

int
count()

Count of items returned in THIS page.

getIterator()

{@inheritDoc}

mixed
first()

Returns the first item or null.

mixed
last()

Returns the last item or null.

bool
is_empty()

Returns true when no items were returned.

bool
is_not_empty()

Returns true when at least one item exists.

array
to_array()

Convert to array for JSON or external APIs.

Details

at line 47
__construct(array $items, int $total, int|null $page, int|null $per_page, bool $is_std_class)

No description

Parameters

array $items

Final dataset

int $total

Total rows matching query

int|null $page

Current page

int|null $per_page
bool $is_std_class

at line 58
array items()

No description

Return Value

array

at line 68
int total()

Returns total number of items matching the query, ignoring pagination.

Return Value

int

at line 78
bool is_std_class()

Indicates whether the items are stdClass objects instead of Domain objects.

Return Value

bool

at line 88
bool is_paginated()

Indicates whether the result is paginated.

Return Value

bool

at line 98
int|null page()

Returns current page number.

Return Value

int|null

at line 108
int|null perpage()

Returns number of items per page.

Return Value

int|null

at line 117
int pages()

Returns total number of pages.

When pagination is disabled, always returns 1.

Return Value

int

at line 129
int count()

Count of items returned in THIS page.

Return Value

int

at line 143
Traversable getIterator()

{@inheritDoc}

Return Value

Traversable

at line 157
mixed first()

Returns the first item or null.

Return Value

mixed

at line 167
mixed last()

Returns the last item or null.

Return Value

mixed

at line 179
bool is_empty()

Returns true when no items were returned.

Return Value

bool

at line 187
bool is_not_empty()

Returns true when at least one item exists.

Return Value

bool

at line 196
array to_array()

Convert to array for JSON or external APIs.

Directly returns internal resolved dataset.

Return Value

array