Oihana PHP Arango

buildEdgeVariable.php

Table of Contents

Functions

buildEdgeVariable()  : string
Builds a single AQL 'LET' subquery string for a specific edge relation.

Functions

buildEdgeVariable()

Builds a single AQL 'LET' subquery string for a specific edge relation.

buildEdgeVariable(string|null $name[, array<string|int, mixed> $definition = [] ][, string $startVertex = AQL::DOC ][, ContainerInterface|null $container = null ][, array<string|int, mixed> $init = [] ]) : string

This method generates a complete traversal subquery, enclosed in parentheses, which is assigned to a 'LET' variable. It handles direction, filtering, sorting, and shaping of the results.

Example output: LET myFriends = ( FOR v, e IN OUTBOUND 'users/123' friends_edge ... RETURN v.name )

Parameters
$name : string|null

The logical name for this variable (e.g., 'friends', 'comments'). This is used as the AQL 'LET' variable name.

$definition : array<string|int, mixed> = []

Configuration array for the traversal. Expected keys:

  • AQL::MODEL: (string) The class name of the Edges model.
  • AQL::DIRECTION: (string|null) Traversal direction (OUTBOUND, INBOUND).
  • AQL::UNIQUE: (string|null) Optional AQL variable name, overrides $name.
  • AQL::EDGES: (array) Further edge definitions for nested queries.
  • AQL::JOINS: (array) Join definitions for the target model.
  • AQL::SKIN: (string|null) A 'skin' name to select specific fields.
  • AQL::SORT: (string|array|null) Sort definition (see getSortEdgeVariableExpression).
$startVertex : string = AQL::DOC

The AQL variable name of the starting vertex (default 'doc').

$container : ContainerInterface|null = null

The DI Container reference.

$init : array<string|int, mixed> = []

Optional associative array definitions.

Tags
throws
Exception

If Traversal direction is invalid.

ContainerExceptionInterface

If the Edges model cannot be resolved from the container.

NotFoundExceptionInterface

If the Edges model cannot be resolved from the container.

ReflectionException
UnexpectedValueException

If $name is empty, the model is invalid, or the collection is not set.

Return values
string

The complete AQL 'LET' statement.

On this page

Search results