ContainableBehavior Class Reference

Inheritance diagram for ContainableBehavior:

ModelBehavior Object List of all members.

Public Member Functions

 afterFind (&$Model, $results, $primary)
 beforeFind (&$Model, $query)
 contain (&$Model)
 containments (&$Model, $contain, $containments=array(), $throwErrors=null)
 containmentsMap ($containments)
 fieldDependencies (&$Model, $map, $fields=array())
 resetBindings (&$Model)
 setup (&$Model, $settings=array())

Public Attributes

 $runtime = array()
 $types = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany')

Detailed Description

Definition at line 34 of file containable.php.


Member Function Documentation

ContainableBehavior::afterFind ( &$  Model,
results,
primary 
)

Resets original associations on models that may have receive multiple, subsequent unbindings.

Parameters:
object $Model Model on which we are resetting
array $results Results of the find operation
bool $primary true if this is the primary model that issued the find operation, false otherwise public

Reimplemented from ModelBehavior.

Definition at line 212 of file containable.php.

ContainableBehavior::beforeFind ( &$  Model,
query 
)

Runs before a find() operation. Used to allow 'contain' setting as part of the find call, like this:

Model->find('all', array('contain' => array('Model1', 'Model2')));

Model->find('all', array('contain' => array( 'Model1' => array('Model11', 'Model12'), 'Model2', 'Model3' => array( 'Model31' => 'Model311', 'Model32', 'Model33' => array('Model331', 'Model332') )));

Parameters:
object $Model Model using the behavior
array $query Query parameters as set by cake
Returns:
array public

Reimplemented from ModelBehavior.

Definition at line 96 of file containable.php.

References contain(), containments(), containmentsMap(), and fieldDependencies().

ContainableBehavior::contain ( &$  Model  ) 

Unbinds all relations from a model except the specified ones. Calling this function without parameters unbinds all related models.

Parameters:
object $Model Model on which binding restriction is being applied
Returns:
void public

Definition at line 228 of file containable.php.

References am().

Referenced by beforeFind().

ContainableBehavior::containments ( &$  Model,
contain,
containments = array(),
throwErrors = null 
)

Process containments for model.

Parameters:
object $Model Model on which binding restriction is being applied
array $contain Parameters to use for restricting this model
array $containments Current set of containments
bool $throwErrors Wether unexisting bindings show throw errors
Returns:
array Containments public

Definition at line 266 of file containable.php.

References __(), a(), Set::merge(), offset(), and order.

Referenced by beforeFind().

ContainableBehavior::containmentsMap ( containments  ) 

Build the map of containments

Parameters:
array $containments Containments
Returns:
array Built containments public

Definition at line 414 of file containable.php.

Referenced by beforeFind().

ContainableBehavior::fieldDependencies ( &$  Model,
map,
fields = array() 
)

Calculate needed fields to fetch the required bindings for the given model.

Parameters:
object $Model Model
array $map Map of relations for given model
mixed $fields If array, fields to initially load, if false use $Model as primary model
Returns:
array Fields public

Definition at line 369 of file containable.php.

Referenced by beforeFind().

ContainableBehavior::resetBindings ( &$  Model  ) 

Permanently restore the original binding settings of given model, useful for restoring the bindings after using 'reset' => false as part of the contain call.

Parameters:
object $Model Model on which to reset bindings
Returns:
void public

Definition at line 242 of file containable.php.

ContainableBehavior::setup ( &$  Model,
settings = array() 
)

Initiate behavior for the model using specified settings.

Available settings:

Parameters:
object $Model Model using the behavior
array $settings Settings to override for model. public

Reimplemented from ModelBehavior.

Definition at line 67 of file containable.php.

References ModelBehavior::$settings.


Member Data Documentation

ContainableBehavior::$runtime = array()

Definition at line 48 of file containable.php.

ContainableBehavior::$types = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany')

Definition at line 41 of file containable.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:55 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7