Oihana PHP Arango

ascKey.php

Table of Contents

Functions

ascKey()  : string
Returns the ascending form of a sort key in the textual sort grammar (the same grammar consumed by `SortTrait::prepareSort` and the HTTP `?sort=` query parameter).

Functions

ascKey()

Returns the ascending form of a sort key in the textual sort grammar (the same grammar consumed by `SortTrait::prepareSort` and the HTTP `?sort=` query parameter).

ascKey(string $key) : string

The ascending form is the key itself — no leading -. The helper exists for symmetry with descKey() and to make sort intent explicit at call site, avoiding magic-string concatenations.

Do not confuse with aqlAsc(), which builds the AQL output token ("doc.name ASC") — this helper produces the HTTP/textual input token ("name").

Parameters
$key : string

The sort field (typically a typed constant such as Prop::CREATED).

Tags
example
use App\Enums\Prop;
use oihana\arango\enums\Arango;

use function oihana\arango\helpers\ascKey;
use function oihana\arango\helpers\sortKeys;

Arango::SORT => ascKey( Prop::NAME ) ;                          // 'name'
Arango::SORT => sortKeys( descKey( Prop::CREATED ) , ascKey( Prop::NAME ) ) ;
see
descKey()

Descending counterpart.

sortKeys()

Joins multiple sort tokens with a comma.

author

Marc Alcaraz

Return values
string

The ascending sort token.

On this page

Search results