HasFacetEdgeAggregate uses trait:short
Builds the AQL filter fragment for an {@see \oihana\arango\models\enums\Facet::EDGE_AGGREGATE} facet: the aggregate counterpart of {@see HasFacetEdge}. Instead of testing for the mere existence of a linked vertex, it aggregates a numeric field over ALL vertices reached through an inbound edge traversal and compares the result to a threshold — `AGG(FOR doc_<key> IN INBOUND doc <edge> RETURN doc_<key>.<field>) <op> @<key>_0`.
The aggregation logic (aggregator / field / comparator / threshold resolution)
is shared with HasFacetJoinAggregate through HasFacetAggregateConditions;
only the iteration source differs (an INBOUND traversal — no FILTER needed,
the traversal already targets the right vertices).
Tags
Table of Contents
Methods
- prepareAggregateConditions() : string
- Builds an aggregate facet expression.
- prepareFacetEdgeAggregate() : string
- Prepares an edge aggregate facet.
Methods
prepareAggregateConditions()
Builds an aggregate facet expression.
protected
prepareAggregateConditions(mixed $value, array<string|int, mixed> $facet, string $forSource, string|null $prefix, string $docRef, string $key, array<string|int, mixed> &$binds) : string
Resolves the aggregator, field, comparator and threshold (URL overriding
the definition), then emits
AGG(FOR … [FILTER prefix] RETURN related.field) <comparator> @<key>_0.
Parameters
- $value : mixed
-
The facet value: a scalar threshold, or an
{agg, field, op, val}object. - $facet : array<string|int, mixed>
-
The facet definition (
Facet::AGG,AQL::FIELDS,Facet::OP). - $forSource : string
-
The compiled
FOR …source (traversal or collection). - $prefix : string|null
-
An extra condition AND-ed inside the FILTER (e.g. a join match), or null.
- $docRef : string
-
The related-document variable (e.g.
doc_comments). - $key : string
-
The facet key, used to namespace the bind name.
- $binds : array<string|int, mixed>
-
The bind variables, populated by reference.
Tags
Return values
string —The AQL fragment, or an empty string when no threshold is supplied.
prepareFacetEdgeAggregate()
Prepares an edge aggregate facet.
protected
prepareFacetEdgeAggregate(string $key, mixed $value, array<string|int, mixed> &$binds, array<string|int, mixed> $facet, string $doc) : string
Parameters
- $key : string
-
The facet key (also the related-document variable suffix).
- $value : mixed
-
A scalar threshold, or an
{agg, field, op, val}object. - $binds : array<string|int, mixed>
-
The bind variables, populated by reference.
- $facet : array<string|int, mixed>
-
The facet definition (
AQL::EDGE,Facet::AGG,AQL::FIELDS,Facet::OP). - $doc : string
-
The main document reference.