PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TActiveRecordRelation

Base class for active record relationships.

Direct known subclasses

TActiveRecordBelongsTo, TActiveRecordHasMany, TActiveRecordHasManyAssociation, TActiveRecordHasOne
Abstract
Package: System\Data\ActiveRecord\Relations
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo <weizho[at]gmail[dot]com>
Version: $Id$
Since: 3.1
Located at Data/ActiveRecord/Relations/TActiveRecordRelation.php
Methods summary
public
# __construct( TActiveRecordRelationContext $context, mixed $criteria )
protected TActiveRecordRelationContext
# getContext( )

Returns

TActiveRecordRelationContext
protected TActiveRecordCriteria
# getCriteria( )

Returns

TActiveRecordCriteria
protected TActiveRecord
# getSourceRecord( )

Returns

TActiveRecord
abstract protected
# collectForeignObjects( mixed & $results )
public mixed
# __call( string $method, array $args )

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.

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.

Parameters

$method
string
method name called
$args
array
method arguments

Returns

mixed
TActiveRecord or array of TActiveRecord results depending on the method called.
public boolean
# fetchResultsInto( mixed $obj )

Fetch results for current relationship.

Fetch results for current relationship.

Returns

boolean
always true.
protected array
# findForeignKeys( TActiveRecord $from, TActiveRecord $matchesRecord, mixed $loose = false )

Returns foreign keys in $fromRecord 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.

Returns foreign keys in $fromRecord 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.

Parameters

$from
TActiveRecord
$fromRecord
$matchesRecord
TActiveRecord
$matchesRecord
$loose

Returns

array
foreign keys with source column names as key and foreign column names as value.
abstract public array
# getRelationForeignKeys( )

Returns

array
foreign key field names as key and object properties as value.

Since

3.1.2
protected string
# getObjectHash( mixed $obj, array $properties )

Parameters

$obj
mixed
object or array to be hashed
$properties
array
name of property for hashing the properties.

Returns

string
object hash using crc32 and serialize.
protected TActiveRecord[]
# findForeignObjects( array $fields, array $indexValues )

Fetches the foreign objects using TActiveRecord::findAllByIndex()

Fetches the foreign objects using TActiveRecord::findAllByIndex()

Parameters

$fields
array
field names
$indexValues
array
foreign key index values.

Returns

TActiveRecord[]
foreign objects.
protected array
# getIndexValues( array $keys, array $results )

Obtain the foreign key index values from the results.

Obtain the foreign key index values from the results.

Parameters

$keys
array
property names
$results
array
TActiveRecord results

Returns

array
foreign key index values.
protected
# populateResult( array & $results, array $properties, array & $fkObjects, array $fields )

Populate the results with the foreign objects found.

Populate the results with the foreign objects found.

Parameters

$results
array
source results
$properties
array
source property names
$fkObjects
array
foreign objects
$fields
array
foreign object field names.
protected
# setResultCollection( array & $results, array & $collections, array $properties )

Populates the result array with foreign objects (matched using foreign key hashed property values).

Populates the result array with foreign objects (matched using foreign key hashed property values).

Parameters

$results
array
$results
$collections
array
$collections
$properties
array
property names
protected
# setObjectProperty( TActiveRecord $source, array $properties, array & $collections )

Sets the foreign objects to the given property on the source object.

Sets the foreign objects to the given property on the source object.

Parameters

$source
TActiveRecord
source object.
$properties
array
source properties
$collections
array
foreign objects.
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO