- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
TActiveRecordBelongsTo
TActiveRecordHasMany
TActiveRecordHasManyAssociation
TActiveRecordHasOne
TActiveRecordRelation
TActiveRecordRelationContext

Keyword

# Class TActiveRecordRelationContext

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
Author: Wei Zhuo <weizho[at]gmail[dot]com>

Constructor Summary
public | __construct Array

Method Summary
string | getAssociationTable ()
string | getCondition ()
string | getFkField ()
string | getForeignRecordClass ()
TActiveRecord | getForeignRecordFinder ()
array | getParameters ()
string | getProperty ()
void | getPropertyValue ()
array | getRelationForeignKeys ()
TActiveRecordRelation | getRelationHandler ( TActiveRecordCriteria $criteria) Creates and return the TActiveRecordRelation handler for specific relationships.
string | getRelationType ()
TActiveRecord | getSourceRecord ()
boolean | hasAssociationTable ()
boolean | hasFkField ()
boolean | hasRecordRelation ()
protected void | isEmptyFkObject ( mixed $obj)
TActiveRecordRelationCommand | updateAssociatedRecords ( mixed $updateBelongsTo)

Constructor Details

## __construct

public __construct | Array

Method Details

## getAssociationTable

public string getAssociationTable | ()

Output
string | the M-N relationship association table name.
Exception

## getCondition

public string getCondition | ()

Output
string | the query condition for the relation as specified in RELATIONS
Exception

## getFkField

public string getFkField | ()

Output
string | foreign key field names, comma delimited.
Exception

## getForeignRecordClass

public string getForeignRecordClass | ()

Output
string | foreign record class name.
Exception

## getForeignRecordFinder

public TActiveRecord getForeignRecordFinder | ()

Output
TActiveRecord | corresponding relationship foreign object finder instance.
Exception

## getParameters

public array getParameters | ()

Output
array | the query parameters for the relation as specified in RELATIONS
Exception

## getProperty

public string getProperty | ()

Output
string | name of the record property that the relationship results will be assigned to.
Exception

## getPropertyValue

public void getPropertyValue | ()

Output
Exception

## getRelationForeignKeys

public array getRelationForeignKeys | ()

Output
array | foreign key of this relations, the keys is dependent on the relationship type.
Exception

## getRelationHandler

public TActiveRecordRelation getRelationHandler | (TActiveRecordCriteria $criteria )

Creates and return the TActiveRecordRelation handler for specific relationships.

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

Input
TActiveRecordCriteria | $criteria | search criteria
Output
TActiveRecordRelation | record relationship handler instnace.
Exception
throws | TActiveRecordException if property is not defined or missing.

## getRelationType

public string getRelationType | ()

Output
string | HAS_MANY, HAS_ONE, or BELONGS_TO
Exception

## getSourceRecord

public TActiveRecord getSourceRecord | ()

Output
TActiveRecord | the active record instance that queried for its related records.
Exception

## hasAssociationTable

public boolean hasAssociationTable | ()

Output
boolean | true if the relationship is HAS_MANY and requires an association table.
Exception

## hasFkField

public boolean hasFkField | ()

Output
boolean | true if the 3rd element of an TActiveRecord::$RELATION entry is set.
Exception

## hasRecordRelation

public boolean hasRecordRelation | ()

Output
boolean | true if the relation is defined in TActiveRecord::$RELATIONS
Exception

## isEmptyFkObject

protected void isEmptyFkObject | (mixed $obj )

Input
mixed | $obj |
Output
Exception

## updateAssociatedRecords

public TActiveRecordRelationCommand updateAssociatedRecords | (mixed $updateBelongsTo )

Input
mixed | $updateBelongsTo |
Output
Exception