QueryIDTrait
Provides a consistent mechanism for managing an internal query identifier (`queryId`), which can be used in dynamically constructed queries (e.g., AQL), log tracing, or caching.
This trait:
- Stores a private query identifier string
- Allows programmatic access to get or set the query ID
- Automatically generates a default ID if none is provided
- Supports initialization via associative arrays (e.g., input parameters or config)
Tags
Table of Contents
Constants
- QUERY = 'query'
- The 'query' parameter constant.
- QUERY_ID = 'queryId'
- The 'queryId' parameter constant.
Properties
- $queryId : string
- The internal query identifier.
Methods
- getQueryID() : string
- Returns the internal query identifier.
- setQueryID() : void
- Sets the internal query identifier.
Constants
QUERY
The 'query' parameter constant.
public
mixed
QUERY
= 'query'
QUERY_ID
The 'queryId' parameter constant.
public
mixed
QUERY_ID
= 'queryId'
Properties
$queryId
The internal query identifier.
protected
string
$queryId
This property holds the unique identifier string used internally for query referencing, debugging, or mapping purposes.
Methods
getQueryID()
Returns the internal query identifier.
public
getQueryID() : string
Tags
Return values
string —The current value of the query ID.
setQueryID()
Sets the internal query identifier.
public
setQueryID(string|array<string|int, mixed>|null $init) : void
Accepts a string value or an associative array that contains the key 'queryId'.
If null is passed, a default ID is auto-generated using query_<random>
.
Parameters
- $init : string|array<string|int, mixed>|null
-
The initial ID value, or an array with key 'queryId'.