本文整理汇总了PHP中FOS\UserBundle\Model\UserManagerInterface::refreshUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManagerInterface::refreshUser方法的具体用法?PHP UserManagerInterface::refreshUser怎么用?PHP UserManagerInterface::refreshUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOS\UserBundle\Model\UserManagerInterface
的用法示例。
在下文中一共展示了UserManagerInterface::refreshUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshUser
/**
* {@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;
}
示例2: refreshUser
/**
* {@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: refreshUser
/**
* {@inheritDoc}
*/
public function refreshUser(UserInterface $user)
{
return $this->userManager->refreshUser($user);
}