In CakPHP 3.6.0 Console Commands have been added to replace Shells and Tasks long term.
I'm currently designing a cronjob command to execute other commands in different time intervals. So I want to run a command from a Command class like this:
namespace App\Command;
// ...
class CronjobCommand extends Command
{
public function execute(Arguments $args, ConsoleIo $io)
{
// Run other command
}
}
For Shells / Tasks it is possible to use Cake\Console\ShellDispatcher
:
$shell = new ShellDispatcher();
$output = $shell->run(['cake', $task]);
but this does not work for Commands. As I did not find any information in the docs, any ideas how to solve this problem?