Oihana PHP Arango

aqlFieldMap.php

Table of Contents

Functions

aqlFieldMap()  : string
Generates an AQL expression for mapping an array field to structured documents.

Functions

aqlFieldMap()

Generates an AQL expression for mapping an array field to structured documents.

aqlFieldMap(string $key, string $doc, array<string|int, mixed> $options[, ContainerInterface|null $container = null ][, array<string|int, mixed> $init = [] ]) : string

This method creates a sub-query that iterates over an array in the document and returns each element with only the specified fields.

Example output:

addresses: ( FOR item IN doc.addresses RETURN { street: item.street, city: item.city } )
Parameters
$key : string

The field key in the parent document (e.g., "addresses").

$doc : string

The document reference for AQL (e.g., "doc").

$options : array<string|int, mixed>

Field options:

  • Field::FIELDS: Array of sub-field definitions to include in each mapped item
  • Field::NAME: Optional source field name (defaults to $key)
$container : ContainerInterface|null = null

The optional DI Container reference.

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

The optional associative array definition.

Tags
throws
ContainerExceptionInterface
NotFoundExceptionInterface
ReflectionException
UnsupportedOperationException
BindException
ConstantException
since
1.0.0
author

Marc Alcaraz

Return values
string

AQL snippet with the array mapping expression.

On this page

Search results