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.
103 lines
3.0 KiB
103 lines
3.0 KiB
13 years ago
|
<?php
|
||
|
/**
|
||
13 years ago
|
* ActiveRecordBehavior class file.
|
||
13 years ago
|
*
|
||
|
* @link http://www.yiiframework.com/
|
||
13 years ago
|
* @copyright Copyright © 2008-2012 Yii Software LLC
|
||
13 years ago
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
|
|
||
12 years ago
|
namespace yii\db;
|
||
13 years ago
|
|
||
|
use yii\base\ModelBehavior;
|
||
|
|
||
13 years ago
|
/**
|
||
13 years ago
|
* ActiveRecordBehavior is the base class for behaviors that can be attached to [[ActiveRecord]].
|
||
|
*
|
||
|
* Compared to [[\yii\base\ModelBehavior]], ActiveRecordBehavior responds to more events
|
||
|
* that are specific to [[ActiveRecord]].
|
||
13 years ago
|
*
|
||
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
||
13 years ago
|
* @since 2.0
|
||
13 years ago
|
*/
|
||
13 years ago
|
class ActiveRecordBehavior extends ModelBehavior
|
||
13 years ago
|
{
|
||
|
/**
|
||
|
* Declares events and the corresponding event handler methods.
|
||
|
* If you override this method, make sure you merge the parent result to the return value.
|
||
|
* @return array events (array keys) and the corresponding event handler methods (array values).
|
||
13 years ago
|
* @see \yii\base\Behavior::events()
|
||
13 years ago
|
*/
|
||
|
public function events()
|
||
|
{
|
||
|
return array_merge(parent::events(), array(
|
||
13 years ago
|
'beforeInsert' => 'beforeInsert',
|
||
|
'afterInsert' => 'afterInsert',
|
||
|
'beforeUpdate' => 'beforeUpdate',
|
||
|
'afterUpdate' => 'afterUpdate',
|
||
|
'beforeDelete' => 'beforeDelete',
|
||
|
'afterDelete' => 'afterDelete',
|
||
13 years ago
|
));
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `beforeInsert` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* You may set the [[ModelEvent::isValid|isValid]] property of the event parameter
|
||
|
* to be false to quit the ActiveRecord inserting process.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
13 years ago
|
public function beforeInsert($event)
|
||
13 years ago
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `afterInsert` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
13 years ago
|
public function afterInsert($event)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `beforeUpdate` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* You may set the [[ModelEvent::isValid|isValid]] property of the event parameter
|
||
|
* to be false to quit the ActiveRecord updating process.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
|
public function beforeUpdate($event)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `afterUpdate` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
|
public function afterUpdate($event)
|
||
13 years ago
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `beforeDelete` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* You may set the [[ModelEvent::isValid|isValid]] property of the event parameter
|
||
|
* to be false to quit the ActiveRecord deleting process.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
|
public function beforeDelete($event)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
13 years ago
|
* Responds to the owner's `afterDelete` event.
|
||
|
* Overrides this method if you want to handle the corresponding event of the owner.
|
||
|
* @param \yii\base\ModelEvent $event event parameter
|
||
13 years ago
|
*/
|
||
|
public function afterDelete($event)
|
||
|
{
|
||
|
}
|
||
|
}
|