diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cfbe27..0112910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +* dev-master + * HOTFIX #18 Fixed command issues (sorting and shortcut) + * 0.2.0 (2016-02-27) * ENHANCEMENT #-- Added debug tasks command and extended storage * ENHANCEMENT #-- Moved command name to service definition diff --git a/src/Command/DebugTasksCommand.php b/src/Command/DebugTasksCommand.php index 652073a..b047005 100644 --- a/src/Command/DebugTasksCommand.php +++ b/src/Command/DebugTasksCommand.php @@ -47,13 +47,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $limit = $input->getOption('limit'); if (null !== $key) { - $tasks = $this->storage->findByKey($key, $limit); + $tasks = $this->storage->findByKey($key, $limit, 'DESC'); } else { - $tasks = $this->storage->findAll($limit); + $tasks = $this->storage->findAll($limit, 'DESC'); } $table = new Table($output); - $table->setHeaders(array('uuid', 'key', 'task-name', 'execution-date', 'completed', 'start', 'duration')); + $table->setHeaders(['uuid', 'key', 'task-name', 'execution-date', 'completed', 'start', 'duration']); foreach ($tasks as $task) { $start = null; diff --git a/src/Command/ScheduleTaskCommand.php b/src/Command/ScheduleTaskCommand.php index 3f3c609..c33bd5c 100644 --- a/src/Command/ScheduleTaskCommand.php +++ b/src/Command/ScheduleTaskCommand.php @@ -38,7 +38,7 @@ protected function configure() ->addArgument('handler', InputArgument::REQUIRED) ->addArgument('workload', InputArgument::OPTIONAL) ->addOption('cron-expression', 'c', InputOption::VALUE_REQUIRED) - ->addOption('end-date', 'e', InputOption::VALUE_REQUIRED) + ->addOption('end-date', null, InputOption::VALUE_REQUIRED) ->addOption('key', 'k', InputOption::VALUE_REQUIRED); } diff --git a/src/Storage/DoctrineStorage.php b/src/Storage/DoctrineStorage.php index 057ab94..9b55713 100644 --- a/src/Storage/DoctrineStorage.php +++ b/src/Storage/DoctrineStorage.php @@ -70,26 +70,26 @@ function (TaskEntity $entity) { /** * {@inheritdoc} */ - public function findAll($limit = null) + public function findAll($limit = null, $sortOrder = 'ASC') { return array_map( function (TaskEntity $entity) { return $entity->getTask(); }, - $this->taskRepository->findBy([], null, $limit) + $this->taskRepository->findBy([], ['executionDate' => $sortOrder], $limit) ); } /** * {@inheritdoc} */ - public function findByKey($key, $limit = null) + public function findByKey($key, $limit = null, $sortOrder = 'ASC') { return array_map( function (TaskEntity $entity) { return $entity->getTask(); }, - $this->taskRepository->findBy(['key' => $key], null, $limit) + $this->taskRepository->findBy(['key' => $key], ['executionDate' => $sortOrder], $limit) ); }