MIDDAG for Moodle

result_interface extends Countable, IteratorAggregate

Interface for immutable result container returned by the Query Engine.

Table of Contents

Methods

first()  : null|T
Returns the first item or null.
is_empty()  : bool
Returns true when no items were returned.
is_not_empty()  : bool
Returns true when at least one item exists.
is_paginated()  : bool
Indicates whether the result is paginated.
is_std_class()  : bool
Indicates whether the items are stdClass objects instead of Domain objects.
items()  : array<int, T>
last()  : null|T
Returns the last item or null.
page()  : null|int
Returns current page number.
pages()  : int
Returns total number of pages.
perpage()  : null|int
Returns number of items per page.
to_array()  : array<int, T>
Convert to array for JSON or external APIs.
total()  : int
Returns total number of items matching the query, ignoring pagination.

Methods

first()

Returns the first item or null.

public first() : null|T
Return values
null|T

is_empty()

Returns true when no items were returned.

public is_empty() : bool
Return values
bool

is_not_empty()

Returns true when at least one item exists.

public is_not_empty() : bool
Return values
bool

is_paginated()

Indicates whether the result is paginated.

public is_paginated() : bool
Return values
bool

is_std_class()

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

public is_std_class() : bool
Return values
bool

last()

Returns the last item or null.

public last() : null|T
Return values
null|T

page()

Returns current page number.

public page() : null|int
Return values
null|int

pages()

Returns total number of pages.

public pages() : int

When pagination is disabled, always returns 1.

Return values
int

perpage()

Returns number of items per page.

public perpage() : null|int
Return values
null|int

to_array()

Convert to array for JSON or external APIs.

public to_array() : array<int, T>

Directly returns internal resolved dataset.

Return values
array<int, T>

total()

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

public total() : int
Return values
int

        
On this page

Search results