aqlFieldDocument.php
Table of Contents
Functions
- aqlFieldDocument() : string
- Generates an AQL key/value expression for a DOCUMENT-type field.
Functions
aqlFieldDocument()
Generates an AQL key/value expression for a DOCUMENT-type field.
aqlFieldDocument(string $key, string $doc, array<string|int, mixed> $options[, ContainerInterface|null $container = null ][, array<string|int, mixed> $init = [] ]) : string
This helper handles nested document fields and can include subfields recursively.
- If
$options[Field::FIELDS]is provided as an array of subfields, it generates a nested{ ... }expression usingaqlFields(). - If no subfields are defined, it falls back to a default field expression using
aqlFieldDefault().
Example usage:
// Simple document field
aqlFieldDocument('author', 'doc', ['name' => 'author']);
// Produces: "author: doc.author"
// Document field with nested subfields
aqlFieldDocument( 'author', 'doc',
[
Field::NAME => 'author',
Field::FIELDS =>
[
'firstName' => Filter::DEFAULT ,
'lastName' => Filter::DEFAULT ,
]
]);
// Produces: "author: { firstName: doc.author.firstName, lastName: doc.author.lastName }"
Parameters
- $key : string
-
The key of the field in the parent document.
- $doc : string
-
The document variable or reference for the field.
- $options : array<string|int, mixed>
-
Field options, typically including:
- Field::NAME => actual key name in the document
- Field::FIELDS => array of nested subfields
- $container : ContainerInterface|null = null
-
The optional DI Container reference.
- $init : array<string|int, mixed> = []
-
Optional associative array definition.
Tags
Return values
string —AQL key/value expression representing the document field.