class Query extends Query

A Query is used to filter and order collections when making API requests.

Constants

DATE_FORMAT

ISO8601 but with the seconds forced to 0.

Methods

__construct()

Query constructor.

from Query
array
getQueryData()

Returns the parameters to execute this query.

string
getQueryString()

The urlencoded query string for this query.

from Query
$this
setSkip(int|null $skip)

Sets the index of the first result to retrieve. To reset set to NULL.

from Query
int|null
getSkip()

Returns the index of the first result to retrieve. Can return NULL if no index is specified.

from Query
$this
setLimit(int|null $limit)

Set the maximum number of results to retrieve. To reset set to NULL;

from Query
int|null
getLimit()

Returns the maximum number of results to retrieve. Can return NULL if no maximum is defined.

from Query
$this
orderBy(string|null $field, bool $reverse = false)

Set the order of the items retrieved by this query.

from Query
$this
setContentType(ContentType|string|null $contentType)

Set the content type to which results should be limited. Set to NULL to not filter for a content type.

from Query
string|null
getContentType()

Returns the name of the content type for which results will be retrieved. Can be NULL if no content type is set

from Query
$this
setMimeTypeGroup(string|null $group)

No description

from Query
null|string
getMimeTypeGroup()

No description

from Query
$this
where(string $field, string|DateTimeInterface|Location $value, string|null $operator = null)

Add a filter condition to this query.

from Query
int|null
getInclude()

Get the amount of levels of links that should be resolved.

$this
setInclude(int|null $include)

Set the amount of levels of links that should be resolved.

Details

in Query at line 79
__construct()

Query constructor.

Empty for now, included for forward compatibility.

at line 32
array getQueryData()

Returns the parameters to execute this query.

Return Value

array

in Query at line 124
string getQueryString()

The urlencoded query string for this query.

Return Value

string

in Query at line 140
$this setSkip(int|null $skip)

Sets the index of the first result to retrieve. To reset set to NULL.

Parameters

int|null $skip The index of the first result that will be retrieved. Must be >= 0.

Return Value

$this

Exceptions

RangeException If $skip is not within the specified range

in Query at line 158
int|null getSkip()

Returns the index of the first result to retrieve. Can return NULL if no index is specified.

Return Value

int|null

in Query at line 174
$this setLimit(int|null $limit)

Set the maximum number of results to retrieve. To reset set to NULL;

Parameters

int|null $limit The maximum number of results to retrieve, must be between 1 and 1000 or null

Return Value

$this

Exceptions

RangeException If $maxArguments is not withing the specified range

in Query at line 192
int|null getLimit()

Returns the maximum number of results to retrieve. Can return NULL if no maximum is defined.

Return Value

int|null

in Query at line 210
$this orderBy(string|null $field, bool $reverse = false)

Set the order of the items retrieved by this query.

Note that when ordering Entries by fields you must set the content_type URI query parameter to the ID of the Content Type you want to filter by.

Parameters

string|null $field
bool $reverse

Return Value

$this

in Query at line 229
$this setContentType(ContentType|string|null $contentType)

Set the content type to which results should be limited. Set to NULL to not filter for a content type.

Only works when querying entries.

Parameters

ContentType|string|null $contentType

Return Value

$this

in Query at line 247
string|null getContentType()

Returns the name of the content type for which results will be retrieved. Can be NULL if no content type is set

Return Value

string|null The name of the content type results will be limited to

in Query at line 259
$this setMimeTypeGroup(string|null $group)

Parameters

string|null $group

Return Value

$this

in Query at line 287
null|string getMimeTypeGroup()

Return Value

null|string

in Query at line 318
$this where(string $field, string|DateTimeInterface|Location $value, string|null $operator = null)

Add a filter condition to this query.

Valid operators are - ne - in - nin - exists - lt - lte - gt - gte - match - near - within

Parameters

string $field
string|DateTimeInterface|Location $value
string|null $operator The operator to use for this condition. Default is strict equality.

Return Value

$this

Exceptions

InvalidArgumentException If $operator is not one of the valid values

at line 49
int|null getInclude()

Get the amount of levels of links that should be resolved.

Return Value

int|null

at line 63
$this setInclude(int|null $include)

Set the amount of levels of links that should be resolved.

Parameters

int|null $include

Return Value

$this