sieppl
(Sebastian Kather)
October 17, 2011, 4:22pm
1
Hi!
I am trying to call a console action as described in the Yii guide http://www.yiiframework.com/doc/guide/1.1/en/topics.console#console-command-action - with Yii 1.1.8.
class ImportLegacyDBCommand extends CConsoleCommand {
public function actionTest() {
echo "test called";
}
public function run($args) {
echo "run called";
}
}
In the console (from protected folder of my application): "yiic importlegacydb test"
Expected: "test called"
But the result is: "run called"
Any ideas?
Thanks, Sebastian
tri
(tri - Tommy Riboe)
October 17, 2011, 5:04pm
2
This should work
public function run($args)
{
echo "run called";
parent::run();
}
(untested)
/Tommy
dckurushin
(Diavolonok)
October 17, 2011, 5:20pm
3
yes If you not call the parent, no action will be called!
sieppl
(Sebastian Kather)
October 18, 2011, 7:40am
4
Thanks guys, that was a stupid miss.
RomanP
(Rpodlinov)
May 16, 2013, 4:04pm
5
Sorry I do not have enough karma to add comment to Console Commands.
Could you please leave a comment that for calling actions it requires to use parent::run() in the $this->run method.
public function run($args) {
parent::run($args);
return 0;
}