Hi,
As i see in this page:
http://www.yiiframework.com/doc/guide/1.1/en/basics.controller
I can make a common class file for reuse the code like this:
class PostController extends CController
{
public function actions()
{
return array(
'edit'=>'application.controllers.post.UpdateAction',
);
}
}
and then, the file UpdateAction.php:
class UpdateAction extends CAction
{
public function run()
{
// place the action logic here
}
}
By this trick the UpdateAction() will be accessible to all controllers that return the actions() array above.
But in my case, it doesn’t work because i would like to use the trick as following:
class myController extends Controller {
public function init() {
$this->actionCommon();
parent::init();
}
public function actions()
{
return array(
'common'=>'application.controllers.common',
);
}
....
And (common.php):
class Common extends CAction
{
public function run()
{
$this->reUsedCode();
}
public function reUsedCode() {
...........
}
}
But i get something like :
myController and its behaviors do not have a method or closure named "common"
Is it a bug from Yii ?