Oihana PHP Arango

aqlFieldDefault.php

Table of Contents

Functions

aqlFieldDefault()  : string
Generates a simple AQL key/value expression referencing a document field.

Functions

aqlFieldDefault()

Generates a simple AQL key/value expression referencing a document field.

aqlFieldDefault(string $key, string $doc[, string|null $keyName = null ]) : string

This helper builds a snippet suitable for inclusion in a RETURN { ... } block. It maps a document property to an object key in the AQL result:

  • $key becomes the key in the resulting AQL object.
  • $doc and optional $keyName define the field to reference.

If $keyName is omitted, the same name as $key is used.

Example usage:

aqlFieldDefault( 'name'   , 'doc' ) ; // "name: doc.name"
aqlFieldDefault( 'userId' , 'doc' , 'id'); // "userId: doc.id"
Parameters
$key : string

The key to use in the resulting AQL object (e.g. "name").

$doc : string

The document alias or variable name (e.g. "doc").

$keyName : string|null = null

Optional property name in the document; if omitted, $key is used.

Tags
since
1.0.0
author

Marc Alcaraz

Return values
string

AQL key/value expression string, e.g. "name: doc.name".

On this page

Search results