/** * @param $data * @return Email */ protected function getObjectFromData($data) { $email = new Email(intval($data['ue_id'])); $email->setUser(MapperFactory::getUserMapper()->getFromId($data['u_id'])); $email->setEmail($data['ue_email']); $email->setVerified($data['ue_verified'] == 1); $email->setToken($data['ue_token']); $email->setExpires(new DateTime($data['ue_expires'])); return $email; }
public function sendVerificationEmail(Module $module) { return; $email = new Email(); $email->setEmail($this->getEmail()); $email->setExpires(new DateTime('next week')); $email->setToken(TokenGenerator::getSimplifiedToken(6)); $email->setUser($this); $email->setVerified(false); MapperFactory::getEmailMapper()->create($email); $template = new Template('CatLab/Accounts/mails/verification.phpt'); $template->set('user', $this); $template->set('verify_url', $email->getVerifyURL($module->getRoutePath())); $mail = new Mail(); $mail->setSubject('Email verification'); $mail->setTemplate($template); $mail->getTo()->add($this->getEmail()); $mail->setFrom(Config::get('mailer.from.email')); Mailer::getInstance()->send($mail); }