/**
  * @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;
 }
Example #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;
 }
    /**
     * @return Entity\Message
     */
    protected function getNye2014()
    {
        $message = new Entity\Message();
        $body = <<<EOF
<p>Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. <b>Suspendisse in justo eu magna luctus
suscipit <b>nulla facilisi</b>. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus,
accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at pede suscipit sodales.</p>
EOF;
        $message->setSubject('HNYE Berlin!');
        $message->setBody($body);
        $message->setCampaign($this->getReference('winter2014-campaign'));
        $message->setSendAt(new \DateTime("+20 minutes"));
        $message->setOnHalt(false);
        return $message;
    }