irseoart.com
irseoart.com

Reputation: 31

How RaiseEvent Event Functions Just In One Place in Yii Framework CComponent

as You know for making System Event Based You Should create Event Functions for Each of them so this is sample:

in Controller which Extended CComponents i create function:

public function onDashboardInit($event)
    {
    $this->raiseEvent('onDashboardInit',$event);
    }
public function onAfterLoginForm($event)
        {
                $this->raiseEvent('onAfterLoginForm',$event);
        }
, ............................... so You see for each event we should create function and it makes extra code, so i need a way to remove this extra code may be editing CComponent Magic function is Solution , but how?

Second Question: 2- is this logical to add all those events functions in Controller Class (this Class extends CController) to make Events System Wide So i Can Access All Events Even in Components and Extensions???? is there better way to make Controller Lighter for Proccessing and remove overloading due to lines of code

Upvotes: 1

Views: 241

Answers (0)

Related Questions