I try atach behavior to component (via config) and set eventheandler to component event from this behavior, but it not working, and i don’t get any errors
--------Config---------
'post'=>array(
'class'=>'post',
'behaviors'=>array(
'postbehavior'=>array(
'class'=>'PostBehavior',
),
),
),
---------Component-----------
class Post extends CApplicationComponent{
public function init(){
}
public function onClicked($event){
$this->raiseEvent('onClicked', $event);
}
}
-------------behavior--------------
class PostBehavior extends CBehavior{
public function events(){
return array(
'onClicked'=>'postHeandler',
);
}
public function postHeandler($event){
echo "i am behavor !";
}
}
--------------Controller---------------
public function actionIndex(){
Yii::app()->post->onClicked($event);
$this->render('index');
}