aqlValue.php
Table of Contents
Functions
- aqlValue() : string
- Transform a PHP value into an AQL-compatible expression.
Functions
aqlValue()
Transform a PHP value into an AQL-compatible expression.
aqlValue(mixed $value[, array<string|int, mixed> $rawValues = [] ]) : string
Automatically detects AQL functions using pattern matching and treats them as raw expressions. Also supports manual raw value specification for edge cases.
String handling flow:
+--------------------------+
| Is $val a string? |
+-----------+--------------+
|
No
|--> return $val as-is or throw (non-string)
|
Yes
v
+--------------------------+
| Is $val in rawValues? |
+-----------+--------------+
|
Yes |--> return $val (raw)
|
No
v
+--------------------------+
| Matches AQL function? |
| CONCAT(...), DATE_NOW() |
+-----------+--------------+
|
Yes |--> return $val (raw)
|
No
v
+--------------------------+
| Matches AQL pattern? |
| doc.field, @bind, col/key|
+-----------+--------------+
|
Yes |--> return $val (raw)
|
No
v
+--------------------------+
| Regular string |
| Escape and quote |
| return "'val'" |
+--------------------------+
Parameters
- $value : mixed
-
The PHP value to transform
- $rawValues : array<string|int, mixed> = []
-
Optional list of specific values to treat as raw AQL expressions
Tags
Return values
string —AQL expression representing the value