Example #1
0
 /**
  * @param MailQueue $row
  * @param string $type
  * @return string
  */
 public function __invoke(MailQueue $row, $type)
 {
     if (!$row->has($type)) {
         throw new InvalidArgumentException('wrong type given in class ' . __CLASS__);
     }
     $method = 'get' . ucwords($type);
     $address = $row->{$method}();
     if (null === $address) {
         $address = $this->getMailOptions()->getAddressList()[$row->getTransport()];
         if (!$address instanceof Address) {
             $address = new Address($address['address'], $address['name']);
         }
     }
     if ($address instanceof Address) {
         $address = $address->toString();
     }
     return $address;
 }
Example #2
0
 /**
  * @param \UthandoMail\Model\MailQueue $object
  * @return array
  */
 public function extract($object)
 {
     return ['mailQueueId' => $object->getMailQueueId(), 'recipient' => $this->extractValue('recipient', $object->getRecipient()), 'sender' => $this->extractValue('sender', $object->getSender()), 'subject' => $object->getSubject(), 'body' => $this->extractValue('body', $object->getBody()), 'layout' => $this->extractValue('layout', $object->getLayout()), 'transport' => $object->getTransport(), 'renderer' => $object->getRenderer(), 'priority' => $object->getPriority(), 'dateCreated' => $this->extractValue('dateCreated', $object->getDateCreated())];
 }