Oihana PHP Arango

AqlLiteral

Read onlyYes

Marker value for AQL fragments that must be inlined verbatim into a query string instead of being bound as parameters.

Use this for AQL keywords / function names that cannot be parameterised (ASC, DESC, function identifiers, attribute names received from a server-side whitelist, …). The value MUST come from a trusted source — never from raw user input — since it bypasses the safe binding layer and is interpolated as-is into the final query string.

Example:

$direction = $userInput === 'desc' ? 'DESC' : 'ASC' ; // whitelisted upstream

$cursor = $db->query
(
    aql( 'FOR u IN users SORT u.name ? RETURN u' , aqlLiteral( $direction ) )
) ;
Tags
see
aqlLiteral()

for the function-style helper.

author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$value  : string

Methods

__construct()  : mixed
__toString()  : string
Returns the literal value, so a `AqlLiteral` may be safely interpolated in a string context (e.g. within a `sprintf()` call).

Properties

Methods

__construct()

public __construct(string $value) : mixed
Parameters
$value : string

Raw AQL fragment to inline verbatim into a query.

__toString()

Returns the literal value, so a `AqlLiteral` may be safely interpolated in a string context (e.g. within a `sprintf()` call).

public __toString() : string
Return values
string
On this page

Search results