仿django的信号处理系统 用途: 新添加的模块不改变核心代码捕获系统核心的事件的钩子
Resources ¶
Documentation ¶
Requirements ¶
- Yii 1.0 or above
Installation ¶
- Extract the release file under
protected/extensions
Usage ¶
See the following code example: 一添加组建到config
'signalManager'=>array(
'class'=>'ext.signal.PPhpSignalManager',
),
二在模型所在目录给模型添加需要处理的信号配置文件,模型名_reciever.php
<?php
return array(
array(
'signal'=>'TestSignal',
'method'=>'testSignal',
),
array(
'signal'=>'MemberLogin',
'method'=>'testSignal',
),
);
三 使用
public function actionTest()
{
$signalManager = Yii::app()->signalManager;
$signalManager->send('MemberLogin', new CEvent(xxxx));
}
这样便会触发member模型调用testSignal静态方法处理该事件,仓促写出的,各种情况可能得在使用时该进
Change Log ¶
May 30, 2010 ¶
- Initial release.
Please, fix documentation
Please, fix documentation
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.