Yii2 Bootstrap 3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.6 KiB

14 years ago
<?php
/**
14 years ago
* ModelBehavior class file.
14 years ago
*
* @link http://www.yiiframework.com/
14 years ago
* @copyright Copyright &copy; 2008-2012 Yii Software LLC
14 years ago
* @license http://www.yiiframework.com/license/
*/
14 years ago
namespace yii\base;
14 years ago
/**
14 years ago
* ModelBehavior class.
*
* ModelBehavior is a base class for behaviors that are attached to a model object.
* The model should be an instance of [[Model]] or its child classes.
*
14 years ago
* @author Qiang Xue <qiang.xue@gmail.com>
14 years ago
* @since 2.0
14 years ago
*/
14 years ago
class ModelBehavior extends Behavior
14 years ago
{
/**
13 years ago
* Declares event handlers for the owner's events.
14 years ago
* The default implementation returns the following event handlers:
14 years ago
*
* - `beforeValidate` event
* - `afterValidate` event
14 years ago
*
* You may override these event handler methods to respond to the corresponding owner events.
14 years ago
* @return array events (array keys) and the corresponding event handler methods (array values).
*/
public function events()
{
return array(
'beforeValidate' => 'beforeValidate',
'afterValidate' => 'afterValidate',
14 years ago
);
}
/**
13 years ago
* Responds to the owner's `beforeValidate` event.
* Override this method if you want to handle the `beforeValidate` event of the [[owner]].
13 years ago
* You may set the [[ModelEvent::isValid|isValid]] property of the event parameter
14 years ago
* to be false to cancel the validation process.
13 years ago
* @param ModelEvent $event event parameter
14 years ago
*/
public function beforeValidate($event)
{
}
/**
13 years ago
* Responds to the owner's `afterValidate` event.
* Override this method if you want to handle the `beforeValidate` event of the [[owner]].
14 years ago
* @param Event $event event parameter
14 years ago
*/
public function afterValidate($event)
{
}
}