public function __construct(ConsoleIo $io = null)
{
if (!$this->name) {
list(, $class) = namespaceSplit(get_class($this));
$this->name = str_replace(['Shell', 'Task'], '', $class);
}
$this->_io = $io ?: new ConsoleIo();
$locator = $this->tableLocator() ?: 'Cake\\ORM\\TableRegistry';
$this->modelFactory('Table', [$locator, 'get']);
$this->Tasks = new TaskRegistry($this);
$this->_mergeVars(['tasks'], ['associative' => ['tasks']]);
$this->_io->setLoggers(true);
if (isset($this->modelClass)) {
$this->loadModel();
}
}