for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Task\TaskBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Task\SchedulerInterface;
/**
* Schedule task.
*
* @author @wachterjohannes <[email protected]>
*/
class ScheduleTaskCommand extends Command
{
* @var SchedulerInterface
private $scheduler;
public function __construct(SchedulerInterface $scheduler)
parent::__construct('task:schedule:task');
$this->scheduler = $scheduler;
}
* {@inheritdoc}
protected function configure()
$this
->setDescription('Run pending tasks')
->addArgument('handler', InputArgument::REQUIRED)
->addArgument('workload', InputArgument::OPTIONAL);
protected function execute(InputInterface $input, OutputInterface $output)
$this->scheduler
->createTask($input->getArgument('handler'), $input->getArgument('workload'))
->schedule();