Skip to content

Fixed command issues #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Command/DebugTasksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ScheduleTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Storage/DoctrineStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand Down