Yii 1.1: signal-manager

仿django的信号系统
1 follower

仿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.

Total 1 comment

#445 report it
Spear at 2010/05/31 06:14pm
Please, fix documentation

Please, fix documentation

Leave a comment

Please to leave your comment.

Create extension
Downloads
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: puper
  • Category: Others
  • Votes: -2
  • Downloaded: 270 times
  • Created on: May 30, 2010
  • Last updated: May 30, 2010