Result
About 1 min
Result
Abstract base class for DBI result sets.
class Result implements \Hazaar\DBI\ResultInterface , \CountableProvides common logic for handling result metadata, adapter association, model hydration, and utility methods for collating and grouping results. Implements Countable and ResultInterface.
Properties
meta
protected array $metaadapter
public Adapter $adapterarrayColumns
protected array $arrayColumnsselectGroups
protected array $selectGroupsMethods
__construct
Construct a new result instance and associate it with an adapter.
public __construct(Adapter $adapter): voidParameters
| Parameter | Type | Description |
|---|---|---|
$adapter | Adapter | the database adapter instance |
__toString
Cast the result to a string, returning the SQL query string.
public __toString(): stringsetAdapter
Set the database adapter for this result instance.
public setAdapter(Adapter $adapter): voidParameters
| Parameter | Type | Description |
|---|---|---|
$adapter | Adapter | the database adapter to associate |
count
Get the number of rows in the result set.
public count(): intcollate
Collates a result into a simple key/value array.
public collate(string $indexColumn, string $valueColumn, null $groupColumn): voidThis is useful for generating SELECT lists directly from a resultset.
Parameters
| Parameter | Type | Description |
|---|---|---|
$indexColumn | string | the column to use as the array index |
$valueColumn | string | the column to use as the array value |
$groupColumn | null | optional column name to group items by |
all
public all(): voidfetchModel
Fetches a model instance of the specified class.
public fetchModel(string $modelClass): StructParameters
| Parameter | Type | Description |
|---|---|---|
$modelClass | string | the fully qualified class name of the model to fetch |
fetchAllModel
Fetches a collection of model instances of the specified class.
public fetchAllModel(string $modelClass, ?string $keyColumn): voidParameters
| Parameter | Type | Description |
|---|---|---|
$modelClass | string | the fully qualified class name of the model to fetch |
$keyColumn | string |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000