PrepareMetaOnlyTrait uses trait:short
Prepares the `metaOnly` flag of a list query.
Driven by ?metaOnly=true (any filter_var() boolean form: true, 1,
yes, on). When truthy, the controller skips the document-fetch query
entirely: the list returns an empty result set, while the response metadata
— an exact total (from DocumentsCountTrait::count()),
and, when requested, the facet counts (?facetCounts=) and the numeric bounds
(?bounds=) — is still computed. This is the "give me the sidebar, not the
documents" mode.
It supersedes the counts-only PrepareFacetsOnlyTrait (?facetsOnly=),
which stays a truthy alias.
Tags
Table of Contents
Properties
- $metaOnly : bool
- The durable `metaOnly` default of the controller.
Methods
- initializeMetaOnly() : static
- Initializes the `metaOnly` default from an array.
- prepareMetaOnly() : bool
- Resolves the `metaOnly` flag for a list query.
Properties
$metaOnly
The durable `metaOnly` default of the controller.
public
bool
$metaOnly
= false
When true, list() returns the response metadata (exact total, and, when
requested, the facet counts and numeric bounds) without the documents.
Methods
initializeMetaOnly()
Initializes the `metaOnly` default from an array.
public
initializeMetaOnly([array<string|int, mixed> $init = [] ]) : static
Parameters
- $init : array<string|int, mixed> = []
-
Initialization array, read from the
Arango::META_ONLYkey.
Return values
static —Returns the current instance for method chaining.
prepareMetaOnly()
Resolves the `metaOnly` flag for a list query.
protected
prepareMetaOnly(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ]) : bool
Precedence, from weakest to strongest:
- the controller default MetaOnlyTrait::$metaOnly (itself
falseunlessArango::META_ONLY => truewas wired in the controller$init) ; $args[Arango::META_ONLY], the per-call$initoflist();- the
?metaOnly=query param, which always wins when present.
Parameters
- $request : ServerRequestInterface|null
-
The HTTP request.
- $args : array<string|int, mixed> = []
-
Predefined options (
$args[Arango::META_ONLY]overrides the controller default). - $params : array<string|int, mixed>|null = null
-
Echoed query params, populated by reference.
Return values
bool —True when only the metadata (no documents) is requested.