Exemplo n.º 1
0
 /**
  * @param User $user
  */
 public function sendWelcomeEmail(User $user)
 {
     $template = 'TastdCoreBundle:Email:welcome.html.twig';
     $html = $this->templating->render($template, array('user' => $user));
     $this->sendEmailMessage('[TASTD] Welcome', $html, $this->adminSender, $user->getEmail());
 }
 /**
  * @param User $user
  */
 protected function sendEmail(User $user)
 {
     $data = array();
     $data['userId'] = $user->getId();
     $data['email'] = $user->getEmail();
     $data['total'] = $user->getScore();
     $data['position'] = $this->scoreManager->getScorePosition($user->getId());
     $data['restaurantsCount'] = $this->scoreManager->getLastWeekRestaurantsCount($user->getId());
     $data['restaurantsScore'] = $data['restaurantsCount'] * ScoreManager::COUNT_RESTAURANT_MULTIPLIER;
     $data['followersCount'] = $this->scoreManager->getLastWeekFollowersCount($user->getId());
     $data['followersScore'] = $data['followersCount'] * ScoreManager::COUNT_FOLLOWERS_MULTIPLIER;
     $data['sharedScore'] = $this->scoreManager->getLastWeekCommonReviewsCount($user->getId());
     $data['sharedCount'] = $data['sharedScore'] * ScoreManager::COMMON_REVIEW_MULTIPLIER;
     $this->output->write('    ' . json_encode($data) . PHP_EOL);
     if ($this->isCsvEmail) {
         $this->csv .= implode(',', $data) . PHP_EOL;
     } else {
         $this->mailer->sendRecapEmail($user, $data);
     }
 }