Esempio n. 1
0
 /**
  * Sets the login for a user.
  *
  * @param User  $user
  * @param sring $login
  *
  * @throws InvalidArgumentException if login is not valid.
  * @throws RuntimeException         if login already exists.
  */
 private function doSetLogin(User $user, $login)
 {
     if (null !== $this->repository->findByLogin($login)) {
         throw new RuntimeException(sprintf('User with login %s already exists.', $login));
     }
     $user->setLogin($login);
 }