Inheritance diagram for ContainableBehavior:

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') | |
Definition at line 34 of file containable.php.
| ContainableBehavior::afterFind | ( | &$ | Model, | |
| $ | results, | |||
| $ | primary | |||
| ) |
Resets original associations on models that may have receive multiple, subsequent unbindings.
| 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') )));
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.
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.
| 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 |
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
| array | $containments Containments |
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.
| 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 |
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.
Definition at line 242 of file containable.php.
| ContainableBehavior::setup | ( | &$ | Model, | |
| $ | settings = array() | |||
| ) |
Initiate behavior for the model using specified settings.
Available settings:
| 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.
| 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.
1.4.7