Class AkAssociatedActiveRecord

(line 40)

Description

AkObject
   |
   --AkBaseModel
      |
      --AkAssociatedActiveRecord

Located in File: /AkActiveRecord/AkAssociatedActiveRecord.php

association(force_reload = false) - returns the associated object. Nil is returned if none is found.

association=(associate) - assigns the associate object, extracts the primary key, sets it as the foreign key, and saves the associate object. association.nil? - returns true if there is no associated object. build_association(attributes = {}) - returns a new object of the associated type that has been instantiated with attributes and linked to this object through a foreign key but has not yet been saved. Note: This ONLY works if an association already exists. It will NOT work if the association is nil. create_association(attributes = {}) - returns a new object of the associated type that has been instantiated with attributes and linked to this object through a foreign key and that has already been saved (if it passed the validation). Account#beneficiary (similar to Beneficiary.find(:first, :conditions => "account_id = #{id}")) Account#beneficiary=(beneficiary) (similar to beneficiary.account_id = account.id; beneficiary.save) Account#beneficiary.nil? Account#build_beneficiary (similar to Beneficiary.new("account_id" => id)) Account#create_beneficiary (similar to b = Beneficiary.new("account_id" => id); b.save; b)



Classes extended from AkAssociatedActiveRecord:
AkActiveRecord
Active Record objects doesn't specify their attributes directly, but rather infer them from the table definition with which they're linked. Adding, removing, and changing attributes and their type is done directly in the database. Any change is instantly reflected in the Active Record objects. The mapping that binds a given Active Record class to a certain database table will happen automatically in most common cases, but can be overwritten for the uncommon ones.

Class Variables

Summary:

$_AssociationHandler (line 43)

Data type : mixed

$_associationId = false (line 44)

Data type : mixed

$_associationIds = array() (line 46)

Data type : mixed

$_associations = array() (line 47)

Data type : mixed

$__activeRecordObject = false (line 42)

Data type : mixed

Class Constants

Summary:

Method Detail

Summary:
void &assign ( &$Associated)
void &build ([ $attributes = array()], [ $replace_existing = true])
void constructFinderSqlWithAssociations ( $options, [ $include_owner_as_selection = true])
void constructSql ()
void &create ([ $attributes = array()], [ $replace_existing = true])
void &find ()
void &findWithAssociations ( $options)
void &getAssociated ( $association_type)
void getAssociatedFinderSqlOptions ([ $options = array()])
void getAssociatedHandlerName ( $association_id)
void getAssociationOption ( $option)
void getCollectionHandlerName ( $association_id)
void getId ()
void getType ()
void hasAssociations ()
void &load ()
void &replace ( &$NewAssociated, [ $dont_save = false])
void setAssociationHandler ( &$AssociationHandler,  $association_id)
void setAssociationOption ( $option,  $value)
void _addTableAliasesToAssociatedSql ( $table_alias,  $sql)
void &_findBySqlWithAssociations ( $sql, [ $included_associations = array()], [ $virtual_limit = false])
void _loadAssociationHandler ( $association_type)

Method assign (line 106)

void &assign( &$Associated)

Parameters

  • &$Associated:

Info

Method build (line 119)

void &build( [ $attributes = array()], [ $replace_existing = true])

Returns a new object of the associated type that has been instantiated with attributes and linked to this object through a foreign key but has not yet been saved.

Parameters

  • $attributes:
  • $replace_existing:

Info

Method constructFinderSqlWithAssociations (line 304)

void constructFinderSqlWithAssociations( $options, [ $include_owner_as_selection = true])

Used for generating custom selections for habtm, has_many and has_one queries

Parameters

  • $options:
  • $include_owner_as_selection:

Info

Method constructSql (line 165)

void constructSql( )

Info

Method constructSqlForInclusion (line 170)

void constructSqlForInclusion( )

Info

Method create (line 129)

void &create( [ $attributes = array()], [ $replace_existing = true])

Overridden in child classes as:

AkActiveRecord::create()
Creates an object, instantly saves it as a record (if the validation permits it), and returns it.

Parameters

  • $attributes:
  • $replace_existing:

Info

Method find (line 147)

void &find( )

Overridden in child classes as:

AkActiveRecord::find()
Find operates with three different retrieval approaches: * Find by id: This can either be a specific id find(1), a list of ids find(1, 5, 6), or an array of ids find(array(5, 6, 10)). If no record can be found for all of the listed ids, then RecordNotFound will be raised.

Info

Method findWithAssociations (line 231)

void &findWithAssociations( $options)

Parameters

  • $options:

Info

Method getAssociated (line 91)

void &getAssociated( $association_type)

Gets an array of associated object of selected association type.

Parameters

  • $association_type:

Info

Method getAssociatedFinderSqlOptions (line 175)

void getAssociatedFinderSqlOptions( [ $options = array()])

Parameters

  • $options:

Info

Method getAssociatedHandlerName (line 205)

void getAssociatedHandlerName( $association_id)

Parameters

  • $association_id:

Info

Method getAssociatedIds (line 200)

void getAssociatedIds( )

Info

Method getAssociatedType (line 210)

void getAssociatedType( )

Info

Method getAssociationId (line 190)

void getAssociationId( )

Info

Method getAssociationOption (line 180)

void getAssociationOption( $option)

Parameters

  • $option:

Info

Method getAssociationType (line 215)

void getAssociationType( )

Info

Method getCollectionHandlerName (line 285)

void getCollectionHandlerName( $association_id)

Parameters

  • $association_id:

Info

Method getId (line 100)

void getId( )

Overridden in child classes as:

AkActiveRecord::getId()
Every Active Record class must use "id" as their primary ID. This getter overwrites the native id method, which isn't being used in this context.

Info

Method getType (line 220)

void getType( )

Overridden in child classes as:

AkActiveRecord::getType()
Alias for getModelName()

Info

Method hasAssociations (line 226)

void hasAssociations( )

Info

Method load (line 156)

void &load( )

Info

Method loadAssociations (line 64)

void loadAssociations( )

Info

Method replace (line 138)

void &replace( &$NewAssociated, [ $dont_save = false])

Parameters

  • &$NewAssociated:
  • $dont_save:

Info

Method setAssociationHandler (line 59)

void setAssociationHandler( &$AssociationHandler, $association_id)

Parameters

  • &$AssociationHandler:
  • $association_id:

Info

Method setAssociationOption (line 185)

void setAssociationOption( $option, $value)

Parameters

  • $option:
  • $value:

Info

Method _addTableAliasesToAssociatedSql (line 419)

void _addTableAliasesToAssociatedSql( $table_alias, $sql)

Parameters

  • $table_alias:
  • $sql:

Info

Method _findBySqlWithAssociations (line 338)

void &_findBySqlWithAssociations( $sql, [ $included_associations = array()], [ $virtual_limit = false])

Parameters

  • $sql:
  • $included_associations:
  • $virtual_limit:

Info

  • todo - Refactor in order to increase performance of associated inclussions

Method _loadAssociationHandler (line 49)

void _loadAssociationHandler( $association_type)

Parameters

  • $association_type:

Info

Inherited Variables

Inherited Class Variable Summary

Inherited From Class AkBaseModel

AkBaseModel::$_modelName -

Inherited Methods

Inherited Method Summary

Inherited From Class AkBaseModel

AkBaseModel::getModelName() - Returns current model name

AkBaseModel::getParentModelName() -

AkBaseModel::setModelName() - Sets current model name

AkBaseModel::setParentModelName() -

AkBaseModel::_getIncludedModelNames() -

AkBaseModel::_getModelName() - This method will nicely handle model names even on


Inherited From Class AkObject

AkObject::AkObject() - A hack to support __construct() on PHP 4

AkObject::__construct() - Class constructor, overriden in descendant classes

AkObject::freeMemory() - Unsets circular reference children that are not freed from memory when calling unset() or when the parent object is garbage collected.

AkObject::log() -

AkObject::toString() - Object-to-string conversion

AkObject::__clone() - Clone class (Zend Engine 2 compatibility trick)

AkObject::__destruct() - Class destructor, overriden in descendant classes

AkObject::__toString() -



Documentation generated on Tue, 17 Jun 2008 14:24:46 +0200 by phpDocumentor 1.3.2