HasFilterArray
This trait defines the array filter helpers.
Config
Defines the 'filters' property in the model (Documents) definition.
Models::PLACES => fn( ContainerInterface $container ) => new Documents
(
$container ,
Collections::PLACES ,
[
...
AQL::FILTERS =>
[
Prop::EVENTS => FilterType::ARRAY ,
...
]
...
Tags
Table of Contents
Methods
- prepareFilterArray() : string
- Prepares the filter clause with a string attribute.
- prepareFilterArrayComparator() : string
- Prepares the filter clause with a specific operator.
- prepareFilterArrayKey() : string
- Prepares the filter clause of a string attribute with a specific key and document.
- prepareFilterAtLeast() : string
- Builds an `AT LEAST (n)` array quantifier filter: at least `n` elements of the array satisfy the comparison.
- prepareFilterQuantified() : string
- Builds a quantified comparison on a scalar array via the `quant` key: how many elements satisfy the comparison.
Methods
prepareFilterArray()
Prepares the filter clause with a string attribute.
protected
prepareFilterArray([array<string|int, mixed> $init = [] ][, array<string|int, mixed>|null &$binds = null ][, string $docRef = AQL::DOC ]) : string
Parameters
- $init : array<string|int, mixed> = []
- $binds : array<string|int, mixed>|null = null
- $docRef : string = AQL::DOC
Tags
Return values
stringprepareFilterArrayComparator()
Prepares the filter clause with a specific operator.
protected
prepareFilterArrayComparator([array<string|int, mixed> $init = [] ]) : string
Parameters
- $init : array<string|int, mixed> = []
Return values
stringprepareFilterArrayKey()
Prepares the filter clause of a string attribute with a specific key and document.
protected
prepareFilterArrayKey([string|array<string|int, mixed>|null $init = [] ][, string $docRef = AQL::DOC ]) : string
Parameters
- $init : string|array<string|int, mixed>|null = []
- $docRef : string = AQL::DOC
Tags
Return values
stringprepareFilterAtLeast()
Builds an `AT LEAST (n)` array quantifier filter: at least `n` elements of the array satisfy the comparison.
protected
prepareFilterAtLeast(array<string|int, mixed> $init[, array<string|int, mixed>|null &$binds = null ][, string $docRef = AQL::DOC ]) : string
The operator is the array form ["atLeast.<cmp>", n] (element 0 is the
atLeast.<cmp> code, element 1 the threshold, defaulting to 1). The <cmp>
suffix reuses FilterComparator (eq, ne, gt, ge, lt, le,
in, nin). The threshold is cast to an int and inlined (injection-safe);
the value is bound. The compared key stays alt-aware.
doc.scores AT LEAST (2) >= @value
Parameters
- $init : array<string|int, mixed>
-
The filter init (
op=["atLeast.<cmp>", n]). - $binds : array<string|int, mixed>|null = null
-
The bind variables, populated by reference.
- $docRef : string = AQL::DOC
-
The document reference.
Tags
Return values
stringprepareFilterQuantified()
Builds a quantified comparison on a scalar array via the `quant` key: how many elements satisfy the comparison.
protected
prepareFilterQuantified(array<string|int, mixed> $init[, array<string|int, mixed>|null &$binds = null ][, string $docRef = AQL::DOC ]) : string
The comparator stays in op (a plain FilterComparator code such as
ge); the element-axis quantifier comes from quant and is resolved by
resolveQuantifier() into ANY / ALL /
NONE / AT LEAST (n). This is the unified, recommended form; the legacy
op:"all.ge" and op:["atLeast.ge", n] notations remain valid aliases.
doc.scores ALL >= @value
doc.scores AT LEAST (2) >= @value
Parameters
- $init : array<string|int, mixed>
-
The filter init (
op= comparator code,quant= quantifier). - $binds : array<string|int, mixed>|null = null
-
The bind variables, populated by reference.
- $docRef : string = AQL::DOC
-
The document reference.