示例#1
0
 public function subscribe(NewsletterEvent $event)
 {
     // test if the email is already registered and unsubscribed
     if (null === ($newsletter = NewsletterQuery::create()->findOneByEmail($event->getEmail()))) {
         $newsletter = new NewsletterModel();
     }
     $newsletter->setEmail($event->getEmail())->setFirstname($event->getFirstname())->setLastname($event->getLastname())->setLocale($event->getLocale())->setUnsubscribed(false)->save();
     $event->setNewsletter($newsletter);
 }
示例#2
0
 public function subscribe(NewsletterEvent $event)
 {
     // test if the email is already registered and unsubscribed
     if (null === ($newsletter = NewsletterQuery::create()->findOneByEmail($event->getEmail()))) {
         $newsletter = new NewsletterModel();
     }
     $newsletter->setEmail($event->getEmail())->setFirstname($event->getFirstname())->setLastname($event->getLastname())->setLocale($event->getLocale())->setUnsubscribed(false)->save();
     $event->setNewsletter($newsletter);
     if (ConfigQuery::getNotifyNewsletterSubscription()) {
         $this->dispatcher->dispatch(TheliaEvents::NEWSLETTER_CONFIRM_SUBSCRIPTION, $event);
     }
 }
示例#3
0
 public function subscribe(NewsletterEvent $event)
 {
     $newsletter = new NewsletterModel();
     $newsletter->setEmail($event->getEmail())->setFirstname($event->getFirstname())->setLastname($event->getLastname())->setLocale($event->getLocale())->save();
     $event->setNewsletter($newsletter);
 }