php - Yii Framework : call Controller's function from CAction class -
i want make modular controller separating actions in different class.
problem of actions calling private function of controler.
controller :
class apicontroller extends controller { public function actions() { return array( 'index'=>'application.controllers.api.indexaction', ); } .......... private function _sendresponse($status = 200, $body = '', $content_type = 'text/html') { // code } }
in indexaction.php tried this, doesn't work :
class indexaction extends caction { public function run() { $this->getcontroller()->_sendresponse(204); //this error }
}
the exception
apicontroller , behaviors not have method or closure named "_sendresponse".
is possible i'm trying do?
missing here?
i looks try access private method out of scope of class. not classes inherit can access private method. try public function _sendresponse()
Comments
Post a Comment