From 9d365313aba4c46d0354bb9dbde5c048a700250c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Ma=C5=A1=C3=AD=C4=8Dek?= Date: Thu, 11 Aug 2022 10:56:36 +0200 Subject: [PATCH] Fix Background Queue publish to new interface --- src/Service/QueueService.php | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/Service/QueueService.php b/src/Service/QueueService.php index feab59b..116af38 100644 --- a/src/Service/QueueService.php +++ b/src/Service/QueueService.php @@ -51,7 +51,7 @@ class QueueService { /** @var int */ protected $limit; - /** @var \ADT\BackgroundQueue\Service */ + /** @var \ADT\BackgroundQueue\BackgroundQueue */ protected $backgroundQueueService; /** @var string */ @@ -115,26 +115,6 @@ protected function createQueueEntry(\Nette\Mail\Message $message, $custom = []) return $entry; } - /** - * @param Entity\AbstractMailQueueEntry $entry - * @return mixed - * @throws \Doctrine\ORM\ORMException - * @throws \Doctrine\ORM\OptimisticLockException - */ - protected function createRabbitQueueEntry(Entity\AbstractMailQueueEntry $entry) { - $entityName = $this->backgroundQueueService->getEntityClass(); - $entity = new $entityName; - $entity->setCallbackName($this->backgroundQueueCallbackName); - $entity->setParameters([self::PARAMETER_NAME_MAIL_QUEUE_ENTRY_ID => $entry->getId()]); - $this->em->persist($entry); - $this->em->flush($entry); - - $this->backgroundQueueService->publish($entity); - - return $entity; - } - - /** * @param \Nette\Mail\Message $message @@ -146,7 +126,7 @@ public function enqueue(\Nette\Mail\Message $message, $custom = []) { $this->em->persist($entry); $this->em->flush($entry); - $this->createRabbitQueueEntry($entry); + $this->backgroundQueueService->publish($this->backgroundQueueCallbackName, [self::PARAMETER_NAME_MAIL_QUEUE_ENTRY_ID => $entry->getId()]); return $entry; }