1 | <?php |
||
29 | abstract class BaseSymfonyWorker extends BaseWorker |
||
30 | { |
||
31 | /** |
||
32 | * Symfony event dispatcher. |
||
33 | * |
||
34 | * @var EventDispatcherInterface |
||
35 | */ |
||
36 | private $eventDispatcher; |
||
37 | |||
38 | 2 | public function __construct(ProcessorFactoryInterface $processorFactory, SerializerInterface $serializer, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) |
|
39 | { |
||
40 | parent::__construct($processorFactory, $serializer, $logger); |
||
41 | 2 | $this->eventDispatcher = $eventDispatcher; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Get subsystem name. |
||
46 | * |
||
47 | * This name may be used further to identify worker subsystem in logs or events. |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | abstract public function getSubsystemName(); |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | protected function beforeTranslateHook(&$commandData) |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | protected function beforeGetProcessorHook(CommandInterface $command) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | protected function beforeProcessHook(CommandInterface $command, CommandProcessorInterface $processor) |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | protected function afterProcessHook(CommandInterface $command, CommandProcessorInterface $processor) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | protected function processorErrorHook(CommandInterface $command, CommandProcessorInterface $processor, Exception $e) |
||
100 | |||
101 | /** |
||
102 | * Clear logs. |
||
103 | * |
||
104 | * @return void |
||
105 | */ |
||
106 | 1 | private function clearLogs() |
|
120 | |||
121 | } |
||
122 |