resolveFacetDirection.php
Table of Contents
Functions
- resolveFacetDirection() : string
- Resolves the traversal direction of a linked facet: which way its edges are followed from the listed document.
Functions
resolveFacetDirection()
Resolves the traversal direction of a linked facet: which way its edges are followed from the listed document.
resolveFacetDirection(array<string|int, mixed> $facet) : string
The direction is not a detail of the AQL — it decides whether the facet finds
anything at all. A model whose edges leave the document (doc is the
_from) reaches its vertices OUTBOUND; one whose edges point at it
reaches them INBOUND. Follow the wrong way and the traversal is perfectly
valid and matches nothing, so the facet answers empty buckets in 200
without a word — the shape of silent degradation this library refuses.
Three rules, and each is deliberate:
- the default is Traversal::INBOUND, which is what every linked facet compiled before this option existed — so a declaration that says nothing keeps its query byte for byte;
- Traversal::ANY is accepted, and means what it says: linked in either
direction. It is the right answer for a relation that is not oriented —
with the caveat that a document linked both ways to the same vertex is
then reached twice, so
Facet::DISTINCTearns its keep; - an unknown value is refused, never quietly replaced.
Traversal::get()would have fallen back on the default, turning a typo into empty buckets — the very failure the option exists to close — so Traversal::validate() answers instead.
Parameters
- $facet : array<string|int, mixed>
-
The facet definition. Reads
AQL::DIRECTION.
Tags
Return values
string —The validated direction keyword.