Created
January 15, 2014 09:32
-
-
Save waaadim/8433338 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// TaskController - actionCreate | |
function actionCreate() { | |
... | |
$this->raiseEvent('onTaskCreate', new CEvent($this)); | |
... | |
} | |
public function onTaskCreate($event) { | |
echo '<pre>'; var_dump($event); echo '</pre>'; | |
$this->raiseEvent('onTaskCreate',$event); | |
echo '<pre>'; var_dump($event); echo '</pre>'; die; | |
} | |
// NotificatioBehavior | |
class NotificationBehavior extends CBehavior{ | |
public function events(){ | |
return array( | |
'onTaskCreate'=>'sendNotification', | |
); | |
} | |
public function sendNotification($event){ | |
echo '<pre>'; var_dump($event); echo '</pre>'; die; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment