Class \Prado\Data\ActiveRecord\Relations\TActiveRecordRelation
Base class for active record relationships.
Class hierarchy
Author: Wei Zhuo <weizho[at]gmail[dot]com>Since: 3.1
public
|
__call(string $method, array<string|int, mixed> $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.
Multiple relationship calls can be chain together. |
public
|
|
public
|
|
public
abstract
|
|
public
abstract
|
|
protected
abstract
|
|
protected
|
findForeignKeys(TActiveRecord $from, TActiveRecord $matchesRecord[, bool $loose = false ]) : array<string|int, mixed>
Returns foreign keys in $from with source column names as key
and foreign column names in the corresponding $matchesRecord as value.
The method returns the first matching foreign key between these 2 records. |
protected
|
findForeignObjects(array<string|int, mixed> $fields, array<string|int, mixed> $indexValues) : array<string|int, TActiveRecord>
Fetches the foreign objects using TActiveRecord::findAllByIndex()
|
protected
|
|
protected
|
|
protected
|
getIndexValues(array<string|int, mixed> $keys, array<string|int, mixed> $results) : array<string|int, mixed>
Obtain the foreign key index values from the results.
|
protected
|
|
protected
|
|
protected
|
populateResult(array<string|int, mixed> &$results, array<string|int, mixed> $properties, array<string|int, mixed> &$fkObjects, array<string|int, mixed> $fields) : mixed
Populate the results with the foreign objects found.
|
protected
|
setObjectProperty(TActiveRecord $source, array<string|int, mixed> $properties, array<string|int, mixed> &$collections) : mixed
Sets the foreign objects to the given property on the source object.
|
protected
|
setResultCollection(array<string|int, mixed> &$results, array<string|int, mixed> &$collections, array<string|int, mixed> $properties) : mixed
Populates the result array with foreign objects (matched using foreign key hashed property values).
|
private
|
getFkFields(mixed $fkeys) : mixed
Find matching foreign key fields from the 3rd element of an entry in TActiveRecord::$RELATION.
Assume field names consist of [\w-] character sets. Prefix to the field names ending with a dot are ignored. |
|