| Total Complexity | 6 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class DoctrineClearEntityManagerWorkerSubscriber implements EventSubscriberInterface |
||
| 16 | { |
||
| 17 | private ManagerRegistry $managerRegistry; |
||
| 18 | |||
| 19 | public function __construct(ManagerRegistry $managerRegistry) |
||
| 22 | } |
||
| 23 | |||
| 24 | public function onWorkerMessageHandled(): void |
||
| 25 | { |
||
| 26 | $this->clearEntityManagers(); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function onWorkerMessageFailed(): void |
||
| 30 | { |
||
| 31 | $this->clearEntityManagers(); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return iterable<string, string> |
||
| 36 | */ |
||
| 37 | public static function getSubscribedEvents(): iterable |
||
| 38 | { |
||
| 39 | yield WorkerMessageHandledEvent::class => 'onWorkerMessageHandled'; |
||
| 40 | yield WorkerMessageFailedEvent::class => 'onWorkerMessageFailed'; |
||
| 41 | } |
||
| 42 | |||
| 43 | private function clearEntityManagers(): void |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 |