Exemplo n.º 1
0
 /**
  * @return Entity\Message
  */
 protected function getOldMessage()
 {
     $message = new Entity\Message();
     $message->setSystemMessage(false);
     $message->setSubject('Suspicious Message');
     $message->setBody('Nope');
     $message->setOnHalt(false);
     $message->setSendAt(new \DateTime('-70 minutes'));
     $message->setQueuedAt(new \DateTime('-65 minutes'));
     $message->setCampaign($this->getReference('winter2013-campaign'));
     return $message;
 }
Exemplo n.º 2
0
 /**
  * @TODO: Move to event
  *
  * @param CampaignEntity $entity
  * @param MessageEntity  $message
  *
  * @return bool
  */
 private function handleSystemMessage(CampaignEntity $entity, MessageEntity $message)
 {
     if ($message->getBody() && $message->getSubject()) {
         if (!$message->getId()) {
             $message->setCampaign($entity);
             $message->setQueuedAt(new \DateTime('now'));
             $message->setSendAt(new \DateTime('now'));
             $message->setOnHalt(false);
             $message->setSystemMessage(true);
             $this->systemMessageOp = static::SYSTEM_MESSAGE_CREATED;
         } else {
             $this->systemMessageOp = static::SYSTEM_MESSAGE_UPDATED;
         }
         $this->entityManager->persist($message);
     } elseif ($message->getId()) {
         $this->systemMessageOp = static::SYSTEM_MESSAGE_DELETED;
         $this->entityManager->remove($message);
     } else {
         $this->systemMessageOp = static::SYSTEM_MESSAGE_SKIPPED;
     }
     return true;
 }
Exemplo n.º 3
0
    /**
     * @return Entity\Message
     */
    protected function getHalloween2014()
    {
        $message = new Entity\Message();
        $body = <<<EOF
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui.
Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis
laoreet. <b>Suspendisse in justo eu magna luctus suscipit</b>. Donec lacus nunc, viverra nec, blandit vel, egestas et,
augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. <b>Suspendisse in justo eu magna luctus
suscipit</b>. Curabitur sit amet mauris. <b>Sed non quam</b>. Morbi in dui quis est pulvinar ullamcorper. Nulla
facilisi.</p>
EOF;
        $message->setSubject('Festivals: Halloween');
        $message->setBody($body);
        $message->setCampaign($this->getReference('winter2014-campaign'));
        $message->setSendAt(new \DateTime("-7 minutes"));
        $message->setQueuedAt(new \DateTime("-4 minutes"));
        $message->setOnHalt(false);
        return $message;
    }