| 包 | system.base |
|---|---|
| 继承 | class CModelEvent » CEvent » CComponent |
| 源自 | 1.0 |
| 版本 | $Id: CModelEvent.PHP 2799 2011-01-01 19:31:13Z qiang.xue $ |
| 源码 |
CModelEvent类.
CModelEvent表示模型发起事件所需的参数。
CModelEvent表示模型发起事件所需的参数。
公共属性
| 属性 | 类型 | 描述 | 定义在 |
|---|---|---|---|
| criteria | CDbCrireria | 这个查询条件是一个传递给CActiveRecord的find方法的参数。 注意,这个属性仅在CActiveRecord::onBeforeFind事件中使用。 此属性可以为null。 | CModelEvent |
| handled | boolean | 是否处理事件。默认为false。 当这个值设置为true,其它未处理的事件处理程序。 | CEvent |
| isValid | boolean | 模型是否有效的状态和正常方法执行的周期。默认为true。 例如,当事件发起在CFormModel中,这个对象执行CModel::beforeValidate, 如果通过事件处理程序设置为false,CModel::validate方法将退出后面的事件处理程序。 如果为true,正常的执行周期将继续,包括表单的验证并调用 CModel::afterValidate. | CModelEvent |
| params | mixed | 附加的事件参数. | CEvent |
| sender | object | 事件的发起者 | CEvent |
公共方法
| 方法 | 描述 | 定义在 |
|---|---|---|
| __call() | 如果类中没有调的方法名,则调用这个方法。 | CComponent |
| __construct() | 构造器. | CEvent |
| __get() | 返回一个属性值、一个事件处理程序列表或一个行为名称。 | CComponent |
| __isset() | 检查一个属性是否为null。 | CComponent |
| __set() | 设置一个组件的属性值。 | CComponent |
| __unset() | 设置一个组件的属性为null。 | CComponent |
| asa() | 返回这个名字的行为对象。 | CComponent |
| attachBehavior() | 附加一个行为到组件。 | CComponent |
| attachBehaviors() | 附加一个行为列表到组件。 | CComponent |
| attachEventHandler() | 为事件附加一个事件处理程序。 | CComponent |
| canGetProperty() | 确定属性是否可读。 | CComponent |
| canSetProperty() | 确定属性是否可写。 | CComponent |
| detachBehavior() | 从组件中分离一个行为。 | CComponent |
| detachBehaviors() | 从组件中分离所有行为。 | CComponent |
| detachEventHandler() | 分离一个存在的事件处理程序。 | CComponent |
| disableBehavior() | 禁用一个附加行为。 | CComponent |
| disableBehaviors() | 禁用组件附加的所有行为。 | CComponent |
| enableBehavior() | 启用一个附加行为。 | CComponent |
| enableBehaviors() | 启用组件附加的所有行为。 | CComponent |
| evaLuateExpression() | 计算一个PHP表达式,或根据组件上下文执行回调。 | CComponent |
| getEventHandlers() | 返回一个事件的附加处理程序列表。 | CComponent |
| hasEvent() | 确定一个事件是否定义。 | CComponent |
| hasEventHandler() | 检查事件是否有附加的处理程序。 | CComponent |
| hasProperty() | 确定属性是否被定义。 | CComponent |
| raiseEvent() | 发起一个事件。 | CComponent |
属性详细
criteria
属性
(可用自 v1.1.5)
public CDbCrireria $criteria;
这个查询条件是一个传递给CActiveRecord的find方法的参数。 注意,这个属性仅在CActiveRecord::onBeforeFind事件中使用。 此属性可以为null。
isValid
属性
public boolean $isValid;
模型是否有效的状态和正常方法执行的周期。默认为true。 例如,当事件发起在CFormModel中,这个对象执行CModel::beforeValidate, 如果通过事件处理程序设置为false,CModel::validate方法将退出后面的事件处理程序。 如果为true,正常的执行周期将继续,包括表单的验证并调用 CModel::afterValidate.