resolveEdgeDepthRange.php
Table of Contents
Functions
- resolveEdgeDepthRange() : array{0: int|null, 1: int|null}
- Resolves the traversal depth range declared by an edge definition — the `[ $minDepth , $maxDepth ]` pair handed to {@see \oihana\arango\db\operations\aqlTraversal()}.
Functions
resolveEdgeDepthRange()
Resolves the traversal depth range declared by an edge definition — the `[ $minDepth , $maxDepth ]` pair handed to {@see \oihana\arango\db\operations\aqlTraversal()}.
resolveEdgeDepthRange(array<string|int, mixed> $definition) : array{0: int|null, 1: int|null}
A self-referential relation (a thesaurus, a category tree, an org chart) can
project several levels in a single traversal through AQL::MAX_DEPTH. The rules:
- Neither declared →
[ null , null ], the traversal stays at depth 1 and the emitted AQL is byte-for-byte the un-ranged one. AQL::MAX_DEPTHalone defaults the lower bound to1— the natural1..N.AQL::MIN_DEPTHalone is refused. ArangoDB requires a bounded range, and an unbounded traversal over a self-referential edge risks a runaway cycle.
This lives in its own helper because the list and the count must read the
declaration the same way. They did not: buildEdgeCountVariable() ignored the
range entirely, so a definition declaring AQL::MAX_DEPTH => 5 produced a list of
the whole descent beside a count of the direct children — measured live as 4
rows under a count saying 2. A shared door makes that divergence impossible to
reintroduce, including the refusal rule.
Parameters
- $definition : array<string|int, mixed>
-
The edge definition (reads
AQL::MIN_DEPTH/AQL::MAX_DEPTH).
Tags
Return values
array{0: int|null, 1: int|null} —The [ $minDepth , $maxDepth ] pair.