Oihana PHP Arango

aqlFieldObject.php

Table of Contents

Functions

aqlFieldObject()  : string
Projects a field as a single object : the value itself when it is one, its first element when it is an array, `null` otherwise.

Functions

aqlFieldObject()

Projects a field as a single object : the value itself when it is one, its first element when it is an array, `null` otherwise.

aqlFieldObject(string $key, string $value[, string|null $else = null ]) : string
aqlFieldObject( 'author' , 'doc.author' ) ;
// author:IS_OBJECT(doc.author) ? doc.author : IS_ARRAY(doc.author) ? FIRST(doc.author) : null

With $else, the expression a resolution that gave nothing falls back on — the stored reference of a join, typically, so a record naming a document the target collection does not hold keeps the code it stored instead of losing the key :

aqlFieldObject( 'about' , 'about_j1' , 'doc.about' ) ;
// about:NOT_NULL(IS_OBJECT(about_j1) ? about_j1 : IS_ARRAY(about_j1) ? FIRST(about_j1) : null,doc.about)
Parameters
$key : string

The projected key.

$value : string

The AQL reference of the value — a document path or a LET variable.

$else : string|null = null

The AQL expression to fall back on when the value resolves to null.

Return values
string —

The key:expression fragment.

On this page

Search results