IBehavior
| 包 | system.base | 
|---|---|
| 继承 | interface IBehavior | 
| 子类 | CActiveRecordBehavior, CBehavior, CConsoleCommandBehavior, CModelBehavior, CTimestampBehavior | 
| 源码 | framework/base/interfaces.php | 
IBehavior interfaces is implemented by all behavior classes.
A behavior is a way to enhance a component with additional methods that are defined in the behavior class and not available in the component class.
A behavior is a way to enhance a component with additional methods that are defined in the behavior class and not available in the component class.
公共方法
| 方法 | 描述 | 被定义在 | 
|---|---|---|
| attach() | Attaches the behavior object to the component. | IBehavior | 
| detach() | Detaches the behavior object from the component. | IBehavior | 
| getEnabled() | Returns whether this behavior is enabled | IBehavior | 
| setEnabled() | Sets whether this behavior is enabled | IBehavior | 
方法详情
attach()
方法
| 
abstract public void attach(CComponent $component) | ||
| $component | CComponent | the component that this behavior is to be attached to. | 
Attaches the behavior object to the component.
detach()
方法
| 
abstract public void detach(CComponent $component) | ||
| $component | CComponent | the component that this behavior is to be detached from. | 
Detaches the behavior object from the component.
getEnabled()
方法
| 
abstract public boolean getEnabled() | ||
| {return} | boolean | whether this behavior is enabled | 
setEnabled()
方法
| 
abstract public void setEnabled(boolean $value) | ||
| $value | boolean | whether this behavior is enabled |