Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function queueMessage(\Swift_Mime_Message $message)
 {
     /** @var SpoolItem $mailObject */
     $mailObject = new $this->entityClass();
     $mailObject->setMessage($message);
     $mailObject->setStatus(self::STATUS_READY);
     $this->entityPool->addPersistEntity($mailObject);
     return true;
 }
Пример #2
0
 public function testAddPersistAndFlush()
 {
     $this->entityPool->addPersistEntity($fooEntity = $this->createTestEntity());
     $this->entityPool->addPersistEntity($barEntity = $this->createTestEntity());
     $this->entityManager->expects($this->at(0))->method('persist')->with($fooEntity);
     $this->entityManager->expects($this->at(1))->method('persist')->with($barEntity);
     $this->entityManager->expects($this->at(2))->method('flush');
     $this->entityPool->persistAndFlush($this->entityManager);
     $this->assertAttributeEquals(array(), 'persistEntities', $this->entityPool);
 }
 /**
  * Add swift mailer spool send task to job queue if it has not been added earlier
  *
  * @param string $command
  * @param array  $commandArgs
  * @return Job
  */
 protected function addJob($command, $commandArgs = [])
 {
     if (!$this->hasNotFinishedJob($command)) {
         $this->entityPool->addPersistEntity($this->createJob($command, $commandArgs));
     }
 }