PHP Class lithium\data\collection\RecordSet

Inheritance: extends lithium\data\Collection
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство 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.

Méthodes protégées

Méthode 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 méthode

protected _columnMap ( )

_hydrateRecord() protected méthode

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
Résultat lithium\data\entity\Record Returns a `Record` object as created by the model.

_init() protected méthode

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
Résultat void

_keyIndex() protected méthode

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
Résultat array An array where key are index and value are primary key fieldname.

_mapRecord() protected méthode

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
Résultat object Returns a `Record` object

_populate() protected méthode

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

_set() protected méthode

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
Résultat 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
Résultat 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
Résultat array

$_relationships protected_oe property

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

$_seen protected_oe property

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