I'm having problems... In controllerA I'm using actions to divide my script in several files. So I have:
class ControllerA
{
public function actions()
{
return array(
'foo'=>'application.controllers.foo.FooAction',
);
}
}
Now if I in FooAction file I write:
<?php
class FooAction extends CAction
{
public function run()
{
$model=new model;
}
}
It works as expected. If I do:
<?php
class FooAction extends CAction
{
public function run()
{
$model=new $this->model;
}
}
Yii returns: "Property "FooAction.Model" is not defined. OK, I understand this message so I try to change code in:
<?php
class FooAction extends CAction
{
public function run()
{
$model=new $this->getController()->model;
}
}
But Yii returns: "Parse error: syntax error, unexpected T_OBJECT_OPERATOR in FooAction" line <N>. And I don't understand this... how to solve it? I would like to use actions in external file because think it's a good way to keep a clean code.
Any suggestion?