Skip to content

Commit

Permalink
Merge 4b53eaa into a24b0ab
Browse files Browse the repository at this point in the history
  • Loading branch information
martingold committed Jun 1, 2018
2 parents a24b0ab + 4b53eaa commit 3f149a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .docs/README.md
Expand Up @@ -87,6 +87,7 @@ And don't forget register it.
scheduler:
jobs:
- App\Model\MyAwesomeJob
myOtherJob: App\Model\MyOtherJob
```

## Commands
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListCommand.php
Expand Up @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$table->setHeaders(['Key', 'Type', 'Is due', 'Cron', 'Callback']);
$dateTime = new DateTime();
foreach ($jobs as $key => $job) {
$table->addRow(self::formatRow($key, $job, $dateTime));
$table->addRow(self::formatRow(is_string($key) ? $key : '', $job, $dateTime));
}
$table->render();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/DI/SchedulerExtension.php
Expand Up @@ -45,13 +45,13 @@ public function loadConfiguration(): void
->setAutowired(false);

// Jobs
foreach ($config['jobs'] as $job) {
foreach ($config['jobs'] as $key => $job) {
if (is_array($job)) {
$job = new Statement(CallbackJob::class, [$job['cron'], $job['callback']]);
} else {
$job = new Statement($job);
}
$scheduler->addSetup('add', [$job]);
$scheduler->addSetup('add', [$job, $key]);
}
}

Expand Down

0 comments on commit 3f149a0

Please sign in to comment.