File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Task \TaskBundle \Command ;
4+
5+ use Symfony \Component \Console \Command \Command ;
6+ use Symfony \Component \Console \Input \InputArgument ;
7+ use Symfony \Component \Console \Input \InputInterface ;
8+ use Symfony \Component \Console \Output \OutputInterface ;
9+ use Task \Handler \RegistryInterface ;
10+ use Task \SchedulerInterface ;
11+
12+ /**
13+ * Run pending tasks.
14+ *
15+ * @author @wachterjohannes <johannes.wachter@massiveart.com>
16+ */
17+ class RunHandlerCommand extends Command
18+ {
19+ /**
20+ * @var RegistryInterface
21+ */
22+ private $ registry ;
23+
24+ public function __construct (RegistryInterface $ registry )
25+ {
26+ parent ::__construct ('task:run:handler ' );
27+
28+ $ this ->registry = $ registry ;
29+ }
30+
31+ /**
32+ * {@inheritdoc}
33+ */
34+ protected function configure ()
35+ {
36+ $ this ->setDescription ('Run pending tasks ' )
37+ ->addArgument ('handler ' , InputArgument::REQUIRED )
38+ ->addArgument ('workload ' , InputArgument::OPTIONAL );
39+ }
40+
41+ /**
42+ * {@inheritdoc}
43+ */
44+ protected function execute (InputInterface $ input , OutputInterface $ output )
45+ {
46+ $ this ->registry ->run ($ input ->getArgument ('handler ' ), $ input ->getArgument ('workload ' ));
47+ }
48+ }
Original file line number Diff line number Diff line change 99 <tag name =" console.command" />
1010 </service >
1111
12+ <service id =" task.command.run.handler" class =" Task\TaskBundle\Command\RunHandlerCommand" >
13+ <argument type =" service" id =" task.handler_registry" />
14+
15+ <tag name =" console.command" />
16+ </service >
17+
1218 <service id =" task.command.schedule_task" class =" Task\TaskBundle\Command\ScheduleTaskCommand" >
1319 <argument type =" service" id =" task.scheduler" />
1420
You can’t perform that action at this time.
0 commit comments