Bitrix API

ArrayResult extends Result

Class ArrayResult is for presenting an array as database result with fetch() navigation.

Table of Contents

Methods

__construct()  : mixed
addFetchDataModifier()  : void
Modifier should accept once fetched array as an argument, then modify by link or return new array: - function (&$data) { $data['AGE'] -= 7; } - function ($data) { $data['AGE'] -= 7; return $data; }
addReplacedAliases()  : void
Extends list of aliased columns.
fetch()  : array<string|int, mixed>|false
Fetches one row of the query result and returns it in the associative array of converted data or false on empty data.
fetchAll()  : array<string|int, mixed>
Fetches all the rows of the query result and returns it in the array of associative arrays.
fetchRaw()  : array<string|int, mixed>|false
Fetches one row of the query result and returns it in the associative array of raw DB data or false on empty data.
getConverters()  : array<string|int, callable>
getCount()  : int
Returns record count. It's required to set record count explicitly before.
getFields()  : null
Returns null because there is no way to know the fields.
getFieldsCount()  : int
Returns the number of fields in the result.
getIterator()  : Traversable
Retrieve an external iterator
getLength()  : int
Returns the size in bytes of the last fetched row.
getResource()  : null|resource
Returns database-specific resource of this result.
getSelectedRowsCount()  : int
Returns the number of rows in the result.
getTrackerQuery()  : SqlTrackerQuery|null
Returns current query tracker.
hasBigFields()  : bool
Checks the existence of the big fields in the result.
setConverters()  : mixed
setCount()  : mixed
Sets record count.
setReplacedAliases()  : void
Sets list of aliased columns.
setSerializedFields()  : void
Sets internal list of fields which will be unserialized on fetch.

Methods

__construct()

public __construct(array<string|int, mixed> $result) : mixed
Parameters
$result : array<string|int, mixed>

Array of arrays.

addFetchDataModifier()

Modifier should accept once fetched array as an argument, then modify by link or return new array: - function (&$data) { $data['AGE'] -= 7; } - function ($data) { $data['AGE'] -= 7; return $data; }

public addFetchDataModifier(callable $fetchDataModifier) : void
Parameters
$fetchDataModifier : callable

Valid callback.

Tags
throws
ArgumentException

addReplacedAliases()

Extends list of aliased columns.

public addReplacedAliases(array<string|int, string> $replacedAliases) : void
Parameters
$replacedAliases : array<string|int, string>

Aliases map from tech to human.

Tags
see
Result::setReplacedAliases

fetch()

Fetches one row of the query result and returns it in the associative array of converted data or false on empty data.

public fetch([Converter|null $converter = null ]) : array<string|int, mixed>|false
Parameters
$converter : Converter|null = null

Optional converter to encode data on fetching.

Return values
array<string|int, mixed>|false

fetchAll()

Fetches all the rows of the query result and returns it in the array of associative arrays.

public fetchAll([Converter|null $converter = null ]) : array<string|int, mixed>

Returns an empty array if query has no data.

Parameters
$converter : Converter|null = null

Optional converter to encode data on fetching.

Return values
array<string|int, mixed>

fetchRaw()

Fetches one row of the query result and returns it in the associative array of raw DB data or false on empty data.

public fetchRaw() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

getConverters()

public getConverters() : array<string|int, callable>
Return values
array<string|int, callable>

getCount()

Returns record count. It's required to set record count explicitly before.

public getCount() : int
Tags
throws
ObjectPropertyException
Return values
int

getFields()

Returns null because there is no way to know the fields.

public getFields() : null
Return values
null

getFieldsCount()

Returns the number of fields in the result.

public getFieldsCount() : int
Return values
int

getLength()

Returns the size in bytes of the last fetched row.

public getLength() : int
Return values
int

getResource()

Returns database-specific resource of this result.

public getResource() : null|resource
Return values
null|resource

getSelectedRowsCount()

Returns the number of rows in the result.

public getSelectedRowsCount() : int
Return values
int

hasBigFields()

Checks the existence of the big fields in the result.

public hasBigFields() : bool
Return values
bool

setConverters()

public setConverters(array<string|int, callable> $converters) : mixed
Parameters
$converters : array<string|int, callable>

setCount()

Sets record count.

public setCount(int $n) : mixed
Parameters
$n : int

setReplacedAliases()

Sets list of aliased columns.

public setReplacedAliases(array<string|int, string> $replacedAliases) : void

This allows to overcome database limits on length of the column names.

Parameters
$replacedAliases : array<string|int, string>

Aliases map from tech to human.

Tags
see
Result::addReplacedAliases

setSerializedFields()

Sets internal list of fields which will be unserialized on fetch.

public setSerializedFields(array<string|int, mixed> $serializedFields) : void
Parameters
$serializedFields : array<string|int, mixed>

List of fields.


        
On this page

Search results