Documentation clearly states that:
By that, I understand, that to make command work, I need to create /protected/commands directory, put there TestCommand.php file, with following content:
<?php
class TestCommand extends CConsoleCommand {
public function actionJob() {
echo 'test';
return 0;
}
}
And run yiic with following command:
php yiic.php test job
Because only time I have been working with yiic was back then, when I created application, I know, where yiic is located:
php framework/yiic.php test job
Which should echo ‘test’, but it doesn’t. I does not really see “test” command at all.
If we look at yiic source code, I don’t see a hint, where it loads commands from protected/commands, just from YII_PATH.’/cli/commands’ and from path in environmental variable YII_CONSOLE_COMMANDS.
Documentation states, that it should load, but in reality, id does not. And that is because it is not said, that there exists two yiic’s.
One is in framework, called with framework/yiic.php, another is in application, called with protected/yiic.php.
For novice, it would be confusing to understand where is problem and could take hours to understand, that you need to do:
php protected/yiic.php test job
In addition to that, there should be said something, that if one wants to use "Console Command Action" feature, run() method should be removed.