Skip to content

Instantly share code, notes, and snippets.

@waaadim
Created January 15, 2014 09:32
Show Gist options
  • Save waaadim/8433338 to your computer and use it in GitHub Desktop.
Save waaadim/8433338 to your computer and use it in GitHub Desktop.
<?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