Oihana PHP Arango

aqlExpression.php

Table of Contents

Functions

aqlExpression()  : string|null
Converts a value into an AQL expression.

Functions

aqlExpression()

Converts a value into an AQL expression.

aqlExpression(object|string|array<string|int, mixed>|null $value) : string|null

Accepts either:

  • A string representing a raw AQL expression, returned as-is.
  • An array or object representing key-value pairs, converted into an AQL document object using aqlDocument().
  • null, which results in a null return value.

Internally, this function delegates to aqlDocument() when $value is an array or object, and otherwise returns the raw string.

Examples:

echo aqlExpression( "FOR u IN users RETURN u" )               ; // "FOR u IN users RETURN u"
echo aqlExpression( ['name' => 'John', 'age' => 30] )        ; // "{name:'John',age:30}"
echo aqlExpression( [['status', 'active']] )                 ; // "{status:'active'}"
echo aqlExpression( null )                                   ; // null
Parameters
$value : object|string|array<string|int, mixed>|null

The value to convert into an AQL expression.

Tags
throws
UnsupportedOperationException

If a value type is unsupported.

author

Marc Alcaraz

since
1.0.0
Return values
string|null

Returns the raw AQL expression or a converted document string, or null if the input value is null.

On this page

Search results