public function createProgenitor(Progenitor $progenitor, Mailer $mailer)
 {
     $dbProgenitor = $this->em->getRepository('AppBundle:Progenitor')->checkEmailExists($progenitor->getNewsletterUser()->getEmail());
     if ($dbProgenitor === null) {
         $progenitor->setUsername($progenitor->getNewsletterUser()->getEmail());
         $progenitor->setEmail($progenitor->getNewsletterUser()->getEmail());
         $progenitor->setPlainPassword('kinder2');
         $progenitor->setEnabled(true);
         $token = sha1(uniqid(mt_rand(), true));
         // Or whatever you prefer to generate a token
         $progenitor->setConfirmationToken($token);
         $this->em->persist($progenitor);
         $this->em->flush();
         $mailer->sendConfirmationEmailMessage($progenitor);
         return $progenitor->getId();
     }
     return;
 }
示例#2
0
文件: Mailer.php 项目: viettut/todo
 public function __construct($mailer, UrlGeneratorInterface $router, EngineInterface $templating, array $parameters)
 {
     parent::__construct($mailer, $router, $templating, $parameters);
 }
 /**
  * @param StatsReport $report
  */
 public function sendStatsReportMessage(StatsReport $report)
 {
     $message = \Swift_Message::newInstance()->setSubject("BuddySystem - les stats de la semaine!")->setFrom($this::FROM)->setTo($this::BUDDYTEAM)->setCc(array($this::DEV, $this::SCV))->setBody($this->templating->render('BuddySystemMainBundle:Emails:statsreport.html.twig', array('report' => $report)), 'text/html');
     $this->mailer->send($message);
 }