PHP Class Prado\Data\ActiveRecord\Relations\TActiveRecordRelation

Since: 3.1
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
__call ( $method, $args ) : mixed Dispatch the method calls to the source record finder object. When an instance of TActiveRecord or an array of TActiveRecord is returned the corresponding foreign objects are also fetched and assigned.
__construct ( TActiveRecordRelationContext $context, $criteria )
fetchResultsInto ( $obj ) : boolean Fetch results for current relationship.
getRelationForeignKeys ( ) : array

Méthodes protégées

Méthode Description
collectForeignObjects ( &$results )
findForeignKeys ( $from, TActiveRecord $matchesRecord, $loose = false ) : array Returns foreign keys in $fromRecord with source column names as key and foreign column names in the corresponding $matchesRecord as value.
findForeignObjects ( $fields, $indexValues ) : TActiveRecord[] Fetches the foreign objects using TActiveRecord::findAllByIndex()
getContext ( ) : TActiveRecordRelationContext
getCriteria ( ) : TActiveRecordCriteria
getIndexValues ( $keys, $results ) : array Obtain the foreign key index values from the results.
getObjectHash ( $obj, $properties ) : string
getSourceRecord ( ) : TActiveRecord
populateResult ( &$results, $properties, &$fkObjects, $fields ) Populate the results with the foreign objects found.
setObjectProperty ( $source, $properties, &$collections ) Sets the foreign objects to the given property on the source object.
setResultCollection ( array &$results, array &$collections, $properties ) Populates the result array with foreign objects (matched using foreign key hashed property values).

Private Methods

Méthode Description
getFkFields ( $fkeys ) Find matching foreign key fields from the 3rd element of an entry in TActiveRecord::$RELATION.

Method Details

__call() public méthode

Multiple relationship calls can be chain together.
public __call ( $method, $args ) : mixed
Résultat mixed TActiveRecord or array of TActiveRecord results depending on the method called.

__construct() public méthode

public __construct ( TActiveRecordRelationContext $context, $criteria )
$context TActiveRecordRelationContext

collectForeignObjects() abstract protected méthode

abstract protected collectForeignObjects ( &$results )

fetchResultsInto() public méthode

Fetch results for current relationship.
public fetchResultsInto ( $obj ) : boolean
Résultat boolean always true.

findForeignKeys() protected méthode

The method returns the first matching foreign key between these 2 records.
protected findForeignKeys ( $from, TActiveRecord $matchesRecord, $loose = false ) : array
$matchesRecord Prado\Data\ActiveRecord\TActiveRecord
Résultat array foreign keys with source column names as key and foreign column names as value.

findForeignObjects() protected méthode

Fetches the foreign objects using TActiveRecord::findAllByIndex()
protected findForeignObjects ( $fields, $indexValues ) : TActiveRecord[]
Résultat Prado\Data\ActiveRecord\TActiveRecord[] foreign objects.

getContext() protected méthode

protected getContext ( ) : TActiveRecordRelationContext
Résultat TActiveRecordRelationContext

getCriteria() protected méthode

protected getCriteria ( ) : TActiveRecordCriteria
Résultat TActiveRecordCriteria

getIndexValues() protected méthode

Obtain the foreign key index values from the results.
protected getIndexValues ( $keys, $results ) : array
Résultat array foreign key index values.

getObjectHash() protected méthode

protected getObjectHash ( $obj, $properties ) : string
Résultat string object hash using crc32 and serialize.

getRelationForeignKeys() abstract public méthode

Since: 3.1.2
abstract public getRelationForeignKeys ( ) : array
Résultat array foreign key field names as key and object properties as value.

getSourceRecord() protected méthode

protected getSourceRecord ( ) : TActiveRecord
Résultat Prado\Data\ActiveRecord\TActiveRecord

populateResult() protected méthode

Populate the results with the foreign objects found.
protected populateResult ( &$results, $properties, &$fkObjects, $fields )

setObjectProperty() protected méthode

Sets the foreign objects to the given property on the source object.
protected setObjectProperty ( $source, $properties, &$collections )

setResultCollection() protected méthode

Populates the result array with foreign objects (matched using foreign key hashed property values).
protected setResultCollection ( array &$results, array &$collections, $properties )
$results array
$collections array