alterExpression.php
Table of Contents
Functions
- alterExpression() : string
- Apply an `alt` transformation chain to an arbitrary AQL expression.
Functions
alterExpression()
Apply an `alt` transformation chain to an arbitrary AQL expression.
alterExpression(string $expr, mixed $chain[, array<string|int, mixed> $init = [] ]) : string
Side-agnostic core shared by the key (left) and value (right) sides of a
comparison: it wraps $expr — whatever it is (a field reference doc.name, a
bind placeholder @value, or the loop variable CURRENT) — with the
function(s) described by $chain. Used directly by the filter and facet
builders (FilterTrait,
FacetTrait) and by the inline-condition
helpers (buildInlineFilterCondition()), so there is a single implementation.
Supports multiple syntax formats for $chain:
-
Single function: "lower" → LOWER(expr)
-
Function with params (simplified): ["substring", 0, 3] → SUBSTRING(expr, 0, 3)
-
Function chain: ["trim","lower"] → LOWER(TRIM(expr))
-
Mixed chain: ["trim",["substring",0,3],"lower"] → LOWER(SUBSTRING(TRIM(expr), 0, 3))
Parameters
- $expr : string
-
The expression to transform.
- $chain : mixed
-
The transformation chain (string, list of functions, or null for a no-op).
- $init : array<string|int, mixed> = []
-
Filter initialization array (forwarded to FilterFunction for boolean-return checks).
Tags
Return values
string —The transformed expression.