BehaviorCollection Class Reference

Public Member Functions | |
| attach ($behavior, $config=array()) | |
| attached ($name=null) | |
| detach ($name) | |
| disable ($name) | |
| dispatchMethod (&$model, $method, $params=array(), $strict=false) | |
| enable ($name) | |
| enabled ($name=null) | |
| init ($modelName, $behaviors=array()) | |
| methods () | |
| trigger (&$model, $callback, $params=array(), $options=array()) | |
Public Attributes | |
| $_attached = array() | |
| $_disabled = array() | |
| $modelName = null | |
Detailed Description
Definition at line 209 of file behavior.php.
Member Function Documentation
| BehaviorCollection::attach | ( | $ | behavior, | |
| $ | config = array() | |||
| ) |
Attaches a behavior to a model
- Parameters:
-
string $behavior CamelCased name of the behavior to load array $config Behavior configuration parameters
- Returns:
- boolean True on success, false on failure public
Definition at line 265 of file behavior.php.
References $config, disable(), enable(), enabled(), ClassRegistry::getObject(), and App::import().
Referenced by init(), and TreeBehavior::setScope().
| BehaviorCollection::attached | ( | $ | name = null |
) |
Gets the list of attached behaviors, or, whether the given behavior is attached
- Parameters:
-
string $name Optional. The name of the behavior to check the status of. If omitted, returns an array of currently-attached behaviors
- Returns:
- mixed If $name is specified, returns the boolean status of the corresponding behavior. Otherwise, returns an array of all attached behaviors. public
Definition at line 467 of file behavior.php.
| BehaviorCollection::detach | ( | $ | name | ) |
Detaches a behavior from a model
- Parameters:
-
string $name CamelCased name of the behavior to unload public
Definition at line 322 of file behavior.php.
References ClassRegistry::getObject().
| BehaviorCollection::disable | ( | $ | name | ) |
Disables callbacks on a behavior or array of behaviors. Public behavior methods are still callable as normal.
- Parameters:
-
mixed $name CamelCased name of the behavior(s) to disable (string or array)
- Returns:
- void public
Definition at line 357 of file behavior.php.
Referenced by attach().
| BehaviorCollection::dispatchMethod | ( | &$ | model, | |
| $ | method, | |||
| $ | params = array(), |
|||
| $ | strict = false | |||
| ) |
Dispatches a behavior method
- Returns:
- array All methods for all behaviors attached to this object public
Definition at line 385 of file behavior.php.
| BehaviorCollection::enable | ( | $ | name | ) |
Enables callbacks on a behavior or array of behaviors
- Parameters:
-
mixed $name CamelCased name of the behavior(s) to enable (string or array)
- Returns:
- void public
Definition at line 343 of file behavior.php.
Referenced by attach().
| BehaviorCollection::enabled | ( | $ | name = null |
) |
Gets the list of currently-enabled behaviors, or, the current status of a single behavior
- Parameters:
-
string $name Optional. The name of the behavior to check the status of. If omitted, returns an array of currently-enabled behaviors
- Returns:
- mixed If $name is specified, returns the boolean status of the corresponding behavior. Otherwise, returns an array of all enabled behaviors. public
Definition at line 373 of file behavior.php.
Referenced by attach().
| BehaviorCollection::init | ( | $ | modelName, | |
| $ | behaviors = array() | |||
| ) |
Attaches a model object and loads a list of behaviors
public
Definition at line 248 of file behavior.php.
References $config, $modelName, attach(), and Set::normalize().
| BehaviorCollection::methods | ( | ) |
Gets the method list for attached behaviors, i.e. all public, non-callback methods
- Returns:
- array All public methods for all behaviors attached to this collection public
Definition at line 455 of file behavior.php.
| BehaviorCollection::trigger | ( | &$ | model, | |
| $ | callback, | |||
| $ | params = array(), |
|||
| $ | options = array() | |||
| ) |
Dispatches a behavior callback on all attached behavior objects
- Parameters:
-
model $model string $callback array $params array $options
- Returns:
- mixed public
Definition at line 423 of file behavior.php.
Member Data Documentation
| BehaviorCollection::$_attached = array() |
Definition at line 223 of file behavior.php.
| BehaviorCollection::$_disabled = array() |
Definition at line 230 of file behavior.php.
| BehaviorCollection::$modelName = null |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/behavior.php