CLI loads only MainTask class mainAction method

My application structure is: ```php .../www/console.php .../www/apps/tasks/MainTask.php .../www/apps/tasks/MonitoringTask.php ``` console.php code: ```php $loader = new \Phalcon\Loader(); $loader->registerDirs(array('apps/tasks/'))->register(); $di = new \Phalcon\DI\FactoryDefault\CLI(); $di->setShared('router', function() { return new \Phalcon\CLI\Router(); }); $di->setShared('dispatcher', function() { return new \Phalcon\CLI\Dispatcher(); }); $app = new \Phalcon\CLI\Console(); $app->setDI($di); $app->handle($SERVER['argv']); ``` MainTask.php ```php class MainTask extends \Phalcon\CLI\Task { public function mainAction() {
print 'main
task mainaction'; } } ``` MonitoringTask.php ```php class MonitoringTask extends \Phalcon\CLI\Task { public function mainAction() {
print 'monitoring
task main_action'; } } ```

Problem is that when I call monitoring task from CMD ```php php console.php monitoring ``` MainTask mainAction always is executed. When i delete MainTask, I get this error ```php Phalcon\CLI\Dispatcher\Exception: MainTask handler class cannot be loaded File=.....\www\console.php Line=50

0 [internal function]: Phalcon\CLI\Dispatcher->_throwDispatchException('MainTask handle...', 2)

1 [internal function]: Phalcon\Dispatcher->dispatch()

2 ...\www\console.php(50): Phalcon\CLI\Console->handle(Array)

3 {main}

```

I don't understand why MonitoringTask is not found?



83.4k

What phalcon version are you using?



11.8k

I tested with 1.0.1 and 1.1Beta 3.



11.8k

Don't work on 1.1 version too. It seems that $app->handle($_SERVER['argv']); don't process passed parameters. I tried to pass there array with different values and in all cases it loads only MainTask.php. Please help, I'am stuck with my project because of that :(

I think the bug is here: ```php $loader->registerDirs(array('apps/tasks/'))->register(); ``` change it to: ```php $loader->registerDirs(array('FULLPATHTO_apps/tasks/'))->register(); ```



11.8k

No, full path to apps/tasks don't help

it seems that 1.1.0 has new CLI params format: https://github.com/phalcon/cphalcon/issues/601



11.8k

Thank You - now it works. It would be great that for every new version developers could see upgrade guide, for example this issue was important when updated phalcon from 1.0 to 1.1, maybe it could be similar like Zend Framework http://framework.zend.com/manual/1.12/en/migration.html



2.2k

I'm confused about how to actually go about changing what is above so it will work, any clues anyone?

Same here. Any proper info anywhere?