setDescription('List tasks'); return $this; } public function requireSetup() { return false; } protected function doExecute(InputInterface $input, OutputInterface $output) { try { $this->checkSetup(); } catch (\RuntimeException $e) { return self::EXITCODE_SETUP_ERROR; } try { $appbox = $this->getService('phraseanet.appbox'); $task_manager = new task_manager($appbox); $tasks = $task_manager->getTasks(); if (count($tasks) === 0) { $output->writeln('No tasks on your install !'); } foreach ($tasks as $task) { $this->printTask($task, $output); } return 0; } catch (\Exception $e) { return 1; } } protected function printTask(task_abstract $task, OutputInterface &$output) { $message = $task->getID() . "\t" . ($task->getState() ) . "\t" . $task->getTitle(); $output->writeln($message); return $this; } }