Oihana PHP Arango

aqlTraversalRange.php

Table of Contents

Functions

aqlTraversalRange()  : string
Builds an AQL traversal range clause (e.g., `1..1`, `1..5`, `..2`, `3..`).

Functions

aqlTraversalRange()

Builds an AQL traversal range clause (e.g., `1..1`, `1..5`, `..2`, `3..`).

aqlTraversalRange([int|null $minDepth = null ][, int|null $maxDepth = null ][, array<string|int, mixed>|null &$binds = null ][, string $defaultRange = Char::EMPTY ]) : string

Supports

  • Fixed ranges (1..1, 2..5).
  • Open-ended ranges (1.. for "1 or more", ..3 for "up to 3").
  • Bind parameters to avoid query plan cache invalidation.

AQL Syntax

FOR v, e, p IN 1..1 OUTBOUND ...
FOR v, e, p IN 1..5 OUTBOUND ...
FOR v, e, p IN ..3 OUTBOUND ...  // 0 to 3
FOR v, e, p IN 2.. OUTBOUND ...  // 2 or more

Why use bind parameters?

Using placeholders like @minDepth and @maxDepth allows ArangoDB to reuse query execution plans, improving performance for repeated queries.

Examples

// Fixed range
echo aqlTraversalRange(1, 1);
// 1..1

// Open-ended max
echo aqlTraversalRange(1, null);
// 1..

// Open-ended min
echo aqlTraversalRange(null, 3);
// ..3

// With bind parameters
$binds = [];
echo aqlTraversalRange(1, 5, $binds);
// @minDepth..@maxDepth
// $binds = ['minDepth' => 1, 'maxDepth' => 5]

// With null parameters
echo aqlTraversalRange();
// ""
Parameters
$minDepth : int|null = null

Minimum depth (inclusive). If null, no lower bound.

$maxDepth : int|null = null

Maximum depth (inclusive). If null, no upper bound.

$binds : array<string|int, mixed>|null = null

Optional reference to a binds array for parameterized queries.

$defaultRange : string = Char::EMPTY

The default range if $minDepth=null && $maxDepth=null (Default "").

Tags
throws
BindException

If parameter binding fails.

since
1.0.0
author

Marc Alcaraz

Return values
string

AQL traversal range (e.g., "1..1", "@minDepth..@maxDepth").

On this page

Search results