Oihana PHP Arango

append.php

Table of Contents

Functions

append()  : string
Append all elements of one array to another array.

Functions

append()

Append all elements of one array to another array.

append(mixed $anyArray, mixed $values[, bool $unique = false ]) : string

This helper wraps the ArangoDB AQL function APPEND(anyArray, values, unique) to concatenate arrays. All values from the second argument are appended to the end of the first array. If unique is set to true, only values that are not already present in the target array are appended.

Example AQL usage:

APPEND(doc.tags, ["new", "tags"])      // appends values to doc.tags
APPEND(doc.tags, other.tags, true)       // appends only values not present yet
Parameters
$anyArray : mixed

The AQL array expression to append values to.

$values : mixed

The AQL array or value(s) to append.

$unique : bool = false

When true, only append values that are not already in the array.

Tags
example
use function oihana\arango\db\functions\arrays\append;

$expr = append('doc.tags', '["a", "b"]', true);
// Produces: 'APPEND(doc.tags, ["a", "b"], true)'
see
https://docs.arangodb.com/stable/aql/functions/array/#append
since
1.0.0

author Marc Alcaraz

Return values
string

The formatted AQL expression (e.g., 'APPEND(doc.tags, other.tags, true)').

On this page

Search results