Exemplo n.º 1
0
 /**
  * @param User $user
  *
  * @return BetaSignup
  */
 private function createBetaSignup(User $user)
 {
     $em = $this->get('doctrine')->getManager();
     $repo = $em->getRepository('Model:BetaSignup');
     if (null === ($beta = $repo->findOneByEmail($user->getEmail()))) {
         $beta = new BetaSignup();
         $beta->setBetaKey(md5(uniqid()));
         $beta->setEmail($user->getEmail());
         $beta->setTries($user->getWaitingList());
         $beta->setStatus(BetaSignup::STATUS_DEFAULT);
         $em->persist($beta);
     }
     return $beta;
 }
Exemplo n.º 2
0
 public function signupAction(Request $request)
 {
     $email = $request->get('email');
     $session = $request->getSession();
     $beta_key = md5(uniqid(mt_rand(), true));
     $session->set('beta_email', $email);
     $beta = $this->getDoctrine()->getRepository('Model:BetaSignup')->findOneByEmail($email);
     if (!$beta) {
         $beta = new BetaSignup();
         $beta->setEmail($email);
         $beta->setBetaKey($beta_key);
     }
     $beta->setTries($beta->getTries() + 1);
     $this->persistAndFlush($beta);
     return $this->redirect($this->generateUrl('app_core_beta_landing'));
 }