throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.',
get_debug_type($user)));
} $repository =
$this->
getRepository();
if ($repository instanceof UserProviderInterface
) { $refreshedUser =
$repository->
refreshUser($user);
} else { // The user must be reloaded via the primary key as all other data
// might have changed without proper persistence in the database.
// That's the case when the user has been changed by a form with
// validation errors.
if (!
$id =
$this->
getClassMetadata()->
getIdentifierValues($user)) { throw new \
InvalidArgumentException('You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine.'
);
} $refreshedUser =
$repository->
find($id);
if (null ===
$refreshedUser) { $e =
new UserNotFoundException('User with id '.
json_encode($id).' not found.'
);
$e->
setUserIdentifier(json_encode($id));
throw $e;
} }