Oihana PHP Arango

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
since
1.0.0
author

Marc Alcaraz

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_ONLY key.

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:

  1. the controller default MetaOnlyTrait::$metaOnly (itself false unless Arango::META_ONLY => true was wired in the controller $init) ;
  2. $args[Arango::META_ONLY], the per-call $init of list() ;
  3. 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.

On this page

Search results