Skip to content

Commit

Permalink
API Update API to reflect changes to CLI interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 6, 2024
1 parent 56030b9 commit cb79c3f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Tasks/WorkflowReminderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
use SilverStripe\Dev\BuildTask;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Email\Email;
use SilverStripe\HybridExecution\HybridOutput;
use SilverStripe\ORM\FieldType\DBDatetime;
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition;
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowInstance;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;

/**
* A task that sends a reminder email to users assigned to a workflow that has
Expand All @@ -17,12 +19,13 @@
*/
class WorkflowReminderTask extends BuildTask
{
protected $title = 'Workflow Reminder Task';
protected $description = 'Sends out workflow reminder emails to stale workflow instances';
protected string $title = 'Workflow Reminder Task';

private static $segment = 'WorkflowReminderTask';
protected static string $description = 'Sends out workflow reminder emails to stale workflow instances';

public function run($request)
protected static string $commandName = 'WorkflowReminderTask';

protected function execute(InputInterface $input, HybridOutput $output): int
{
$sent = 0;
if (WorkflowInstance::get()->count()) { // Don't attempt the filter if no instances -- prevents a crash
Expand Down Expand Up @@ -69,6 +72,7 @@ public function run($request)
}
}
}
echo "Sent $sent workflow reminder emails.\n";
$output->writeln("Sent $sent workflow reminder emails.");
return Command::SUCCESS;
}
}

0 comments on commit cb79c3f

Please sign in to comment.