PHP Class lithium\data\collection\RecordSet

Inheritance: extends lithium\data\Collection
Datei anzeigen Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Property Type Description
$_columns array A 2D array of column-mapping information, where the top-level key is the fully-namespaced model name, and the sub-arrays are column names.
$_dependencies array A recursive array of relation dependencies where key are relations and value are arrays with their relation dependencies
$_keyIndex array Precompute index of the main model primary key(s) which allow to find values directly in result data without the column name matching process.
$_relationships array Holds the relationships as returned via $this->_query->relationships().
$_seen array Keeps a list of hydrated main record indexes values already seen.

Protected Methods

Method Description
_columnMap ( )
_hydrateRecord ( array $relations, string $primary, array $record, integer $min, integer $max, string $name ) : Record Hydrates a 2 dimensional PDO row Result array recursively.
_init ( ) : void Initializes the record set and uses the database connection to get the column list contained in the query that created this object.
_keyIndex ( ) : array Extracts the numerical index of the primary key in numerical indexed row data.
_mapRecord ( array $row ) : object Converts a PDO Result array to a nested Record object.
_populate ( ) : mixed Extracts the next item from the result resource and wraps it into a Record object.
_set ( $data = null, $offset = null, $options = [] )

Method Details

_columnMap() protected method

protected _columnMap ( )

_hydrateRecord() protected method

Hydrates a 2 dimensional PDO row Result array recursively.
protected _hydrateRecord ( array $relations, string $primary, array $record, integer $min, integer $max, string $name ) : Record
$relations array The cascading with relation
$primary string Model classname
$record array Loaded Records
$min integer
$max integer
$name string Alias name
return lithium\data\entity\Record Returns a `Record` object as created by the model.

_init() protected method

Initializes the record set and uses the database connection to get the column list contained in the query that created this object.
See also: lithium\data\collection\RecordSet::$_columns
protected _init ( ) : void
return void

_keyIndex() protected method

Works only for the main row data and not for relationship rows. This method will also correctly detect a primary key which doesn't come first.
protected _keyIndex ( ) : array
return array An array where key are index and value are primary key fieldname.

_mapRecord() protected method

1. Builds an associative array with data from the row, with joined row data nested under the relationships name. Joined row data is added and new results consumed from the result cursor under the relationships name until the value of the main primary key changes. 2. The built array is then hydrated and returned. Note: Joined records must appear sequentially, when non-sequential records are detected an exception is thrown.
protected _mapRecord ( array $row ) : object
$row array 2 dimensional PDO `Result` array
return object Returns a `Record` object

_populate() protected method

Extracts the next item from the result resource and wraps it into a Record object.
protected _populate ( ) : mixed
return mixed Returns the next `Record` if exists. Returns `null` otherwise

_set() protected method

protected _set ( $data = null, $offset = null, $options = [] )

Property Details

$_columns protected_oe property

A 2D array of column-mapping information, where the top-level key is the fully-namespaced model name, and the sub-arrays are column names.
protected array $_columns
return array

$_dependencies protected_oe property

A recursive array of relation dependencies where key are relations and value are arrays with their relation dependencies
protected array $_dependencies
return array

$_keyIndex protected_oe property

Precompute index of the main model primary key(s) which allow to find values directly in result data without the column name matching process.
protected array $_keyIndex
return array

$_relationships protected_oe property

Holds the relationships as returned via $this->_query->relationships().
protected array $_relationships
return array

$_seen protected_oe property

Keeps a list of hydrated main record indexes values already seen.
protected array $_seen
return array