ConditionsTrait
Provides support for handling model conditions.
This trait defines a container for query or model conditions and exposes an initialization helper to hydrate them from a parameter array (typically coming from a model configuration or options object).
The conditions structure is intentionally left flexible and may vary depending on the model implementation (SQL, NoSQL, in-memory, etc.).
Tags
Table of Contents
Properties
- $conditions : array<string|int, mixed>
- Internal list of model conditions.
Methods
- initializeConditions() : static
- Initializes the model conditions from an initialization array.
Properties
$conditions
Internal list of model conditions.
public
array<string|int, mixed>
$conditions
= []
This array usually represents filtering rules applied to the model, such as WHERE (SQL) or FILTER (AQL) clauses, logical constraints, or driver-specific condition definitions.
Methods
initializeConditions()
Initializes the model conditions from an initialization array.
public
initializeConditions([array<string, mixed> $init = [] ]) : static
The conditions are extracted using the ModelParam::CONDITIONS key if present. If the key is missing, the conditions list is reset to an empty array.
This method is typically called during model construction or configuration hydration.
Parameters
- $init : array<string, mixed> = []
-
Initialization parameters
Return values
static —Returns the current instance for fluent usage