/**
  * Constructor
  *
  * @param Pheanstalk       $pheanstalk
  * @param string           $name
  * @param JobPluginManager $jobPluginManager
  */
 public function __construct(Pheanstalk $pheanstalk, $name, JobPluginManager $jobPluginManager, QueueOptions $options = null)
 {
     $this->pheanstalk = $pheanstalk;
     $this->tubeName = $name;
     if ($options !== null && $options->getTube()) {
         $this->tubeName = $options->getTube();
     }
     parent::__construct($name, $jobPluginManager);
 }
 /**
  * Notify user via sending mail
  * 
  * @access public
  * @param array $mailArray
  * @throws \Exception Missing some required Mail option(s)
  */
 public function notify($mailArray)
 {
     $requiredKeys = array('from', 'to', 'subject', 'templateName', 'templateParameters');
     if (count(array_intersect_key(array_flip($requiredKeys), $mailArray)) !== count($requiredKeys)) {
         throw new \Exception("Missing some required Mail option(s)");
     }
     $mailViewModel = new ViewModel($mailArray['templateParameters']);
     $mailViewModel->setTemplate("notifications/mail/" . $mailArray['templateName']);
     $layout = new ViewModel();
     $layout->setTemplate("notifications/mail/layout");
     $layout->setVariable("emailBody", $this->viewRenderer->render($mailViewModel));
     $htmlMarkup = $this->viewRenderer->render($layout);
     $html = new MimePart($htmlMarkup);
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->setParts(array($html));
     $mailArray["body"] = $body;
     $this->sendEmailJob->setContent($mailArray);
     $this->queue->push($this->sendEmailJob);
 }
Example #3
0
 /**
  * Constructor
  *
  * @param SqsClient        $sqsClient
  * @param SqsQueueOptions  $options
  * @param string           $name
  * @param JobPluginManager $jobPluginManager
  */
 public function __construct(SqsClient $sqsClient, SqsQueueOptions $options, $name, JobPluginManager $jobPluginManager)
 {
     $this->sqsClient = $sqsClient;
     $this->queueOptions = $options;
     parent::__construct($name, $jobPluginManager);
     // If an URL has explicitly been given in the options, let's use it, otherwise we dynamically fetch it
     if (!$this->queueOptions->getQueueUrl()) {
         $queue = $this->sqsClient->getQueueUrl(array('QueueName' => $name));
         $this->queueOptions->setQueueUrl($queue['QueueUrl']);
     }
 }
 /**
  * Constructor
  *
  * @param Connection       $connection
  * @param string           $tableName
  * @param string           $name
  * @param JobPluginManager $jobPluginManager
  */
 public function __construct(Connection $connection, DoctrineOptions $options, $name, JobPluginManager $jobPluginManager)
 {
     $this->connection = $connection;
     $this->options = clone $options;
     parent::__construct($name, $jobPluginManager);
 }