/**
  * @param User $user
  * @return UserSession
  */
 public function getByUser(User $user)
 {
     $userSession = $this->getBy(function (UserSession $userSession) use($user) {
         return $userSession->getUser()->getId() === $user->getId();
     })->first();
     return $userSession ?: null;
 }
 /**
  * @param User $user
  * @return UserSession
  */
 public function getByUser(User $user)
 {
     $criteria = Criteria::create();
     $expr = Criteria::expr();
     $criteria->where($expr->eq('userId', $user->getId()));
     $sessions = $this->getAll($criteria, true);
     return $sessions->getNextElement();
 }
Esempio n. 3
0
 /**
  * @param User $user
  */
 public function disable(User $user)
 {
     $user->disable();
     $this->userRepository->save($user);
 }
Esempio n. 4
0
 /**
  * @Given /^I filled all the signup data$/
  */
 public function iFilledAllTheSignupData()
 {
     $this->user = $this->userManager->create();
     $this->user->enable();
 }
Esempio n. 5
0
 public function __construct(User $user)
 {
     $this->token = md5(uniqid($user->getId(), true));
 }