@@ -51,7 +51,7 @@ class QueueService {
5151 /** @var int */
5252 protected $ limit ;
5353
54- /** @var \ADT\BackgroundQueue\Service */
54+ /** @var \ADT\BackgroundQueue\BackgroundQueue */
5555 protected $ backgroundQueueService ;
5656
5757 /** @var string */
@@ -115,26 +115,6 @@ protected function createQueueEntry(\Nette\Mail\Message $message, $custom = [])
115115 return $ entry ;
116116 }
117117
118- /**
119- * @param Entity\AbstractMailQueueEntry $entry
120- * @return mixed
121- * @throws \Doctrine\ORM\ORMException
122- * @throws \Doctrine\ORM\OptimisticLockException
123- */
124- protected function createRabbitQueueEntry (Entity \AbstractMailQueueEntry $ entry ) {
125- $ entityName = $ this ->backgroundQueueService ->getEntityClass ();
126- $ entity = new $ entityName ;
127- $ entity ->setCallbackName ($ this ->backgroundQueueCallbackName );
128- $ entity ->setParameters ([self ::PARAMETER_NAME_MAIL_QUEUE_ENTRY_ID => $ entry ->getId ()]);
129- $ this ->em ->persist ($ entry );
130- $ this ->em ->flush ($ entry );
131-
132- $ this ->backgroundQueueService ->publish ($ entity );
133-
134- return $ entity ;
135- }
136-
137-
138118
139119 /**
140120 * @param \Nette\Mail\Message $message
@@ -146,7 +126,7 @@ public function enqueue(\Nette\Mail\Message $message, $custom = []) {
146126 $ this ->em ->persist ($ entry );
147127 $ this ->em ->flush ($ entry );
148128
149- $ this ->createRabbitQueueEntry ( $ entry );
129+ $ this ->backgroundQueueService -> publish ( $ this -> backgroundQueueCallbackName , [ self :: PARAMETER_NAME_MAIL_QUEUE_ENTRY_ID => $ entry-> getId ()] );
150130
151131 return $ entry ;
152132 }
0 commit comments