PHP Class Prado\Data\ActiveRecord\Relations\TActiveRecordRelationContext

This class is use internally by passing a context to the TActiveRecordRelation constructor.
Since: 3.1
Exibir arquivo Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
__construct ( $record, $property = null, $relation = null )
getAssociationTable ( ) : string
getCondition ( ) : string
getFkField ( ) : string
getForeignRecordClass ( ) : string
getForeignRecordFinder ( ) : TActiveRecord
getParameters ( ) : array
getProperty ( ) : string
getPropertyValue ( )
getRelationForeignKeys ( ) : array
getRelationHandler ( $criteria = null ) : TActiveRecordRelation Creates and return the TActiveRecordRelation handler for specific relationships.
getRelationType ( ) : string
getSourceRecord ( ) : TActiveRecord
hasAssociationTable ( ) : boolean
hasFkField ( ) : boolean
hasRecordRelation ( ) : boolean
updateAssociatedRecords ( $updateBelongsTo = false ) : TActiveRecordRelationCommand

Protected Methods

Method Description
isEmptyFkObject ( $obj )

Method Details

__construct() public method

public __construct ( $record, $property = null, $relation = null )

getAssociationTable() public method

public getAssociationTable ( ) : string
return string the M-N relationship association table name.

getCondition() public method

Since: 3.1.2
public getCondition ( ) : string
return string the query condition for the relation as specified in RELATIONS

getFkField() public method

Since: 3.1.2
public getFkField ( ) : string
return string foreign key field names, comma delimited.

getForeignRecordClass() public method

public getForeignRecordClass ( ) : string
return string foreign record class name.

getForeignRecordFinder() public method

public getForeignRecordFinder ( ) : TActiveRecord
return Prado\Data\ActiveRecord\TActiveRecord corresponding relationship foreign object finder instance.

getParameters() public method

Since: 3.1.2
public getParameters ( ) : array
return array the query parameters for the relation as specified in RELATIONS

getProperty() public method

public getProperty ( ) : string
return string name of the record property that the relationship results will be assigned to.

getPropertyValue() public method

public getPropertyValue ( )

getRelationForeignKeys() public method

Since: 3.1.2
public getRelationForeignKeys ( ) : array
return array foreign key of this relations, the keys is dependent on the relationship type.

getRelationHandler() public method

An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany, or TActiveRecordHasManyAssocation will be returned.
public getRelationHandler ( $criteria = null ) : TActiveRecordRelation
return TActiveRecordRelation record relationship handler instnace.

getRelationType() public method

public getRelationType ( ) : string
return string HAS_MANY, HAS_ONE, or BELONGS_TO

getSourceRecord() public method

public getSourceRecord ( ) : TActiveRecord
return Prado\Data\ActiveRecord\TActiveRecord the active record instance that queried for its related records.

hasAssociationTable() public method

public hasAssociationTable ( ) : boolean
return boolean true if the relationship is HAS_MANY and requires an association table.

hasFkField() public method

Since: 3.1.2
public hasFkField ( ) : boolean
return boolean true if the 3rd element of an TActiveRecord::$RELATION entry is set.

hasRecordRelation() public method

Since: 3.1.2
public hasRecordRelation ( ) : boolean
return boolean true if the relation is defined in TActiveRecord::$RELATIONS

isEmptyFkObject() protected method

protected isEmptyFkObject ( $obj )

updateAssociatedRecords() public method

public updateAssociatedRecords ( $updateBelongsTo = false ) : TActiveRecordRelationCommand
return TActiveRecordRelationCommand