ModelBehavior Class Reference

Public Member Functions | |
| _addToWhitelist (&$model, $field) | |
| afterDelete (&$model) | |
| afterFind (&$model, $results, $primary) | |
| afterSave (&$model, $created) | |
| beforeDelete (&$model, $cascade=true) | |
| beforeFind (&$model, $query) | |
| beforeSave (&$model) | |
| beforeValidate (&$model) | |
| cleanup (&$model) | |
| dispatchMethod (&$model, $method, $params=array()) | |
| onError (&$model, $error) | |
| setup (&$model, $config=array()) | |
Public Attributes | |
| $mapMethods = array() | |
| $settings = array() | |
Detailed Description
Definition at line 38 of file behavior.php.
Member Function Documentation
| ModelBehavior::_addToWhitelist | ( | &$ | model, | |
| $ | field | |||
| ) |
If $model's whitelist property is non-empty, $field will be added to it. Note: this method should *only* be used in beforeValidate or beforeSave to ensure that it only modifies the whitelist for the current save operation. Also make sure you explicitly set the value of the field which you are allowing.
- Parameters:
-
object $model Model using this behavior string $field Field to be added to $model's whitelist protected
- Returns:
- void
Definition at line 188 of file behavior.php.
| ModelBehavior::afterDelete | ( | &$ | model | ) |
After delete callback
- Parameters:
-
object $model Model using this behavior public
Reimplemented in AclBehavior, and TranslateBehavior.
Definition at line 139 of file behavior.php.
| ModelBehavior::afterFind | ( | &$ | model, | |
| $ | results, | |||
| $ | primary | |||
| ) |
After find callback. Can be used to modify any results returned by find and findAll.
- Parameters:
-
object $model Model using this behavior mixed $results The results of the find operation boolean $primary Whether this model is being queried directly (vs. being queried as an association)
- Returns:
- mixed Result of the find operation public
Reimplemented in TranslateBehavior.
Definition at line 99 of file behavior.php.
| ModelBehavior::afterSave | ( | &$ | model, | |
| $ | created | |||
| ) |
After save callback
- Parameters:
-
object $model Model using this behavior boolean $created True if this save created a new record public
Reimplemented in AclBehavior, TranslateBehavior, and TreeBehavior.
Definition at line 123 of file behavior.php.
| ModelBehavior::beforeDelete | ( | &$ | model, | |
| $ | cascade = true | |||
| ) |
Before delete callback
- Parameters:
-
object $model Model using this behavior boolean $cascade If true records that depend on this record will also be deleted
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 132 of file behavior.php.
| ModelBehavior::beforeFind | ( | &$ | model, | |
| $ | query | |||
| ) |
Before find callback
- Parameters:
-
object $model Model using this behavior array $queryData Data used to execute this query, i.e. conditions, order, etc.
- Returns:
- boolean True if the operation should continue, false if it should abort public
Reimplemented in ContainableBehavior, and TranslateBehavior.
Definition at line 89 of file behavior.php.
| ModelBehavior::beforeSave | ( | &$ | model | ) |
Before save callback
- Parameters:
-
object $model Model using this behavior
- Returns:
- boolean True if the operation should continue, false if it should abort public
Reimplemented in TreeBehavior.
Definition at line 115 of file behavior.php.
Referenced by TranslateBehavior::afterSave(), and TranslateBehavior::beforeValidate().
| ModelBehavior::beforeValidate | ( | &$ | model | ) |
Before validate callback
- Parameters:
-
object $model Model using this behavior
- Returns:
- boolean True if validate operation should continue, false to abort public
Reimplemented in TranslateBehavior.
Definition at line 107 of file behavior.php.
| ModelBehavior::cleanup | ( | &$ | model | ) |
Clean up any initialization this behavior has done on a model. Called when a behavior is dynamically detached from a model using Model::detach().
- Parameters:
-
object $model Model using this behavior public
- See also:
- BehaviorCollection::detach()
Reimplemented in TranslateBehavior.
Definition at line 76 of file behavior.php.
| ModelBehavior::dispatchMethod | ( | &$ | model, | |
| $ | method, | |||
| $ | params = array() | |||
| ) |
Overrides Object::dispatchMethod to account for PHP4's broken reference support
- See also:
- Object::dispatchMethod public
Definition at line 154 of file behavior.php.
| ModelBehavior::onError | ( | &$ | model, | |
| $ | error | |||
| ) |
DataSource error callback
- Parameters:
-
object $model Model using this behavior string $error Error generated in DataSource public
Definition at line 147 of file behavior.php.
| ModelBehavior::setup | ( | &$ | model, | |
| $ | config = array() | |||
| ) |
Setup this behavior with the specified configuration settings.
- Parameters:
-
object $model Model using this behavior array $config Configuration settings for $model public
Reimplemented in AclBehavior, ContainableBehavior, TranslateBehavior, and TreeBehavior.
Definition at line 67 of file behavior.php.
Member Data Documentation
| ModelBehavior::$mapMethods = array() |
Definition at line 59 of file behavior.php.
| ModelBehavior::$settings = array() |
Definition at line 49 of file behavior.php.
Referenced by TreeBehavior::setup(), and ContainableBehavior::setup().
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/behavior.php