Oihana PHP Arango

AltChain

Read onlyYes
FinalYes

An `alt` transformation chain that remembers **who supplied it**.

The alt engine serves two callers that cannot be told apart once the chain is a bare array: a model declaration (Field::ALTERS, Facet::ALT) written in the consumer's own code, and a request (?filter=, ?group=, ?facets=) written by whoever is on the other end of the wire. They need opposite treatments — a declaration may name another field (['like','doc.pattern'], interpolated as written), a request may only supply a value (bound, so it can never become grammar).

Wrapping the chain is what makes the difference survive: the mark travels with the data, so a call site that forgets to pass $init cannot strip it, and alterExpression() raises instead of silently falling back to interpolation.

Build one through trustedAlt() or requestAlt() rather than directly.

Tags
since
1.6.0
author

Marc Alcaraz

Table of Contents

Properties

$chain  : mixed
The wrapped chain, in any of the `alt` notations.
$trusted  : bool
Whether the chain was authored by the consumer's code rather than by a request.

Methods

request()  : self
A chain that arrived with a request: its parameters are bound, never inlined.
trusted()  : self
A chain the consumer's own code authored: interpolated as written.
__construct()  : mixed

Properties

$chain

The wrapped chain, in any of the `alt` notations.

public mixed $chain

$trusted

Whether the chain was authored by the consumer's code rather than by a request.

public bool $trusted

Methods

request()

A chain that arrived with a request: its parameters are bound, never inlined.

public static request(mixed $chain) : self
Parameters
$chain : mixed
Return values
self

trusted()

A chain the consumer's own code authored: interpolated as written.

public static trusted(mixed $chain) : self
Parameters
$chain : mixed
Return values
self

__construct()

private __construct(mixed $chain, bool $trusted) : mixed
Parameters
$chain : mixed
$trusted : bool
On this page

Search results