Example #1
0
 /**
  * @param User $user
  * @param int $expiry_days
  * @return EmailLink
  */
 public function generateEmailLink(User $user, $expiry_days = 7)
 {
     $date = new DateTime();
     $date->modify('+' . $expiry_days . ' days');
     $token = md5(uniqid(rand(), true));
     $link = new EmailLink();
     $link->setUser($user);
     $link->setToken($token);
     $link->setExpiryDate($date);
     return $this->getEmailLinkRepository()->save($link);
 }
Example #2
0
 public function testGetSetUser()
 {
     $dave = new User();
     $this->link->setUser($dave);
     $this->assertInstanceOf('Del\\Entity\\User', $this->link->getUser());
 }