## Class TActiveRecordRelationContext

Description

TActiveRecordRelationContext holds information regarding record relationships such as record relation property name, query criteria and foreign object record class names.

This class is use internally by passing a context to the TActiveRecordRelation constructor.

- since: 3.1
- version: $Id$
- author: Wei Zhuo <weizho[at]gmail[dot]com>

Located in /Data/ActiveRecord/Relations/TActiveRecordRelationContext.php (line 26)

Class Constant Summary
RELATIONS_CONST = 'RELATIONS'
Method Summary
TActiveRecordRelationContext __construct (mixed $source, [mixed $property = null], [mixed $criteria = null])
string getAssociationTable ()
TActiveRecordCriteria getCriteria ()
string getForeignRecordClass ()
TActiveRecord getForeignRecordFinder ()
string getProperty ()
void getPropertyValue ()
array getRecordRelationships ()
TActiveRecordRelation getRelationHandler ()
string getRelationType ()
TActiveRecord getSourceRecord ()
array getSourceRecordRelation (string $property)
boolean hasAssociationTable ()
void isEmptyFkObject (mixed $obj)
TActiveRecordRelationCommand updateAssociatedRecords ([mixed $updateBelongsTo = false])
Methods
Constructor __construct (line 38)

- access: public

TActiveRecordRelationContext __construct (mixed $source, [mixed $property = null], [mixed $criteria = null])
getAssociationTable (line 123)

- return: the M-N relationship association table name.
- access: public

string getAssociationTable ()
getCriteria (line 91)

- return: sql query criteria for fetching the related record.
- access: public

TActiveRecordCriteria getCriteria ()
getForeignRecordClass (line 107)

- return: foreign record class name.
- access: public

string getForeignRecordClass ()
getForeignRecordFinder (line 139)

- return: corresponding relationship foreign object finder instance.
- access: public

TActiveRecord getForeignRecordFinder ()
getProperty (line 83)

- return: name of the record property that the relationship results will be assigned to.
- access: public

string getProperty ()
getPropertyValue (line 74)

- access: public

void getPropertyValue ()
getRecordRelationships (line 68)

- return: the key and values of TActiveRecord::$RELATIONS
- access: public

array getRecordRelationships ()
getRelationHandler (line 150)

Creates and return the TActiveRecordRelation handler for specific relationships.

An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany, or TActiveRecordHasManyAssocation will be returned.

- return: record relationship handler instnace.
- access: public

TActiveRecordRelation getRelationHandler ()
getRelationType (line 115)

- return: HAS_MANY, HAS_ONE, or BELONGS_TO
- access: public

string getRelationType ()
getSourceRecord (line 99)

- return: the active record instance that queried for its related records.
- access: public

TActiveRecord getSourceRecord ()
getSourceRecordRelation (line 53)

Uses ReflectionClass to obtain the relation details array of a given property from the $RELATIONS static property in TActiveRecord.

- return: array($propertyName, $relation) relation definition.
- access: protected
- throws: TActiveRecordException if property is not defined or missing.

array getSourceRecordRelation (string $property)

- string $property: relation property name

hasAssociationTable (line 131)

- return: true if the relationship is HAS_MANY and requires an association table.
- access: public

boolean hasAssociationTable ()
isEmptyFkObject (line 198)

- access: protected

void isEmptyFkObject (mixed $obj)
updateAssociatedRecords (line 179)

- access: public

TActiveRecordRelationCommand updateAssociatedRecords ([mixed $updateBelongsTo = false])
Class Constants
RELATIONS_CONST = 'RELATIONS' (line 31)

static property name in TActiveRecord that defines the record relationships.

Documentation generated on Sun, 30 Sep 2007 19:10:32 -0400 by phpDocumentor 1.3.0RC4