protected function createNewsletterLog($className, NewsletterInterface $newsletter, SubscriberInterface $subscriber, $message)
 {
     /* @var $log \Ibrows\Bundle\NewsletterBundle\Model\Log\LogInterface */
     $log = new $className();
     $log->setNewsletterId($newsletter->getId())->setSubscriberId($subscriber->getId())->setSubscriberEmail($subscriber->getEmail())->setMessage($message)->setMandantName($this->mandantName);
     if ($subscriber instanceof SubscriberGenderTitleInterface) {
         $log->setSubscriberCompanyname($subscriber->getCompanyname())->setSubscriberFirstname($subscriber->getFirstname())->setSubscriberGender($subscriber->getGender())->setSubscriberLastname($subscriber->getLastname())->setSubscriberTitle($subscriber->getTitle());
     }
     if ($subscriber instanceof SubscriberLocaleInterface) {
         $log->setSubscriberLocale($subscriber->getLocale());
     }
     return $log;
 }
 public function __construct(NewsletterInterface $newsletter, SendSettingsInterface $sendSettings)
 {
     parent::__construct();
     $this->setSubject($newsletter->getSubject());
     $this->setSenderName($newsletter->getSenderName());
     $this->setSenderMail($newsletter->getSenderMail());
     $this->setReturnMail($newsletter->getReturnMail());
     $this->setUsername($sendSettings->getUsername());
     $this->setPassword($sendSettings->getPassword());
     $this->setHost($sendSettings->getHost());
     $this->setPort($sendSettings->getPort());
     $this->setEncryption($sendSettings->getEncryption());
     $this->setAuthMode($sendSettings->getAuthMode());
     $this->setScheduled($sendSettings->getStarttime());
     $this->setNewsletterId($newsletter->getId());
     $this->salt = $newsletter->getMandant()->getSalt();
 }
 /**
  * @param  NewsletterInterface   $newsletter
  * @param  string                $hash
  * @return SubscriberInterface
  * @throws NotFoundHttpException
  */
 protected function getSubscriberByHash(NewsletterInterface $newsletter, $hash)
 {
     $subscriber = null;
     foreach ($newsletter->getSubscribers() as $newsletterSubscriber) {
         if ($newsletterSubscriber->getHash() == $hash) {
             return $newsletterSubscriber;
         }
     }
     throw $this->createNotFoundException("Subscriber with hash {$hash} not found in newsletter #" . $newsletter->getId());
 }