FilteredScopeTrait
Builds the **filtered scope** shared by every list-family query: the `FOR` segment (over the View or the collection) and the conjunctive `FILTER` clause.
list(), count(), the facet counts and the bounds all iterate the same set
— so their FOR + FILTER must be built identically, or the numbers would
disagree (a facet bucket or a bound framing a set the list never shows). This
trait is the single source of that construction.
When an active View search is present (AQL::VIEW declaration + a ?search
term), the FOR iterates the View with an index-accelerated SEARCH segment
and the search leaves the FILTER; otherwise the classic collection FOR
with the LIKE sweep in the FILTER is kept. The collection (or the View) is
bound only on its own branch — an unused bind variable would be rejected by
the server.
The trait assumes a host that provides the filtering fragments it composes
(prepareViewSearch(), prepareActive(), prepareFacets(), prepareFilter(),
prepareSearch(), bindView(), bindCollection() and the $conditions
property) — the same host contract as FacetCountsQueryTrait /
BoundsQueryTrait. In practice it is composed by every *QueryTrait of
the list family.
Tags
Table of Contents
Methods
- buildFilteredScope() : array{0: string, 1: ?string}
- Builds the `FOR` segment and the conjunctive `FILTER` clause shared by the list-family queries.
Methods
buildFilteredScope()
Builds the `FOR` segment and the conjunctive `FILTER` clause shared by the list-family queries.
protected
buildFilteredScope([array<string|int, mixed> $init = [] ][, array<string|int, mixed> &$bindVars = [] ]) : array{0: string, 1: ?string}
Parameters
- $init : array<string|int, mixed> = []
-
The query options.
- $bindVars : array<string|int, mixed> = []
-
The bind variables, populated by reference.
Tags
Return values
array{0: string, 1: ?string} —The [ $for, $filter ] pair.