/**
  * {@inheritDoc}
  */
 public function refreshUser(UserInterface $user)
 {
     // Compatibility with FOSUserBundle < 2.0
     if (class_exists('FOS\\UserBundle\\Form\\Handler\\RegistrationFormHandler')) {
         return $this->userManager->refreshUser($user);
     }
     if (!$user instanceof User) {
         throw new UnsupportedUserException(sprintf('Expected an instance of FOS\\UserBundle\\Model\\User, but got "%s".', get_class($user)));
     }
     if (null === ($reloadedUser = $this->userManager->findUserBy(array('id' => $user->getId())))) {
         throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $user->getId()));
     }
     return $user;
 }
 /**
  * {@inheritDoc}
  */
 public function refreshUser(UserInterface $user)
 {
     // Compatibility with FOSUserBundle < 2.0
     if (class_exists('FOS\\UserBundle\\Form\\Handler\\RegistrationFormHandler')) {
         return $this->userManager->refreshUser($user);
     }
     $identifier = $this->properties['identifier'];
     if (!$user instanceof User || !$this->accessor->isReadable($user, $identifier)) {
         throw new UnsupportedUserException(sprintf('Expected an instance of FOS\\UserBundle\\Model\\User, but got "%s".', get_class($user)));
     }
     $userId = $this->accessor->getValue($user, $identifier);
     if (null === ($user = $this->userManager->findUserBy(array($identifier => $userId)))) {
         throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $userId));
     }
     return $user;
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 public function refreshUser(UserInterface $user)
 {
     return $this->userManager->refreshUser($user);
 }