@@ -424,20 +424,18 @@ both are unique in the database. Unfortunately, the native entity provider
424424is only able to handle querying via a single property on the user.
425425
426426To do this, make your ``UserRepository `` implement a special
427- :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserProviderInterface `. This
428- interface requires three methods: ``loadUserByUsername($username) ``,
429- ``refreshUser(UserInterface $user) ``, and ``supportsClass($class) ``::
427+ :class: `Symfony\\ Bridge\\ Doctrine\\ Security\\ User\\ UserLoaderInterface `. This
428+ interface only requires one method: ``loadUserByUsername($username) ``::
430429
431430 // src/AppBundle/Entity/UserRepository.php 
432431 namespace AppBundle\Entity; 
433432
433+  use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface; 
434434 use Symfony\Component\Security\Core\User\UserInterface; 
435-  use Symfony\Component\Security\Core\User\UserProviderInterface; 
436435 use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; 
437-  use Symfony\Component\Security\Core\Exception\UnsupportedUserException; 
438436 use Doctrine\ORM\EntityRepository; 
439437
440-  class UserRepository extends EntityRepository implements UserProviderInterface  
438+  class UserRepository extends EntityRepository implements UserLoaderInterface  
441439 { 
442440 public function loadUserByUsername($username) 
443441 { 
@@ -458,30 +456,12 @@ interface requires three methods: ``loadUserByUsername($username)``,
458456
459457 return $user; 
460458 } 
461- 
462-  public function refreshUser(UserInterface $user) 
463-  { 
464-  $class = get_class($user); 
465-  if (!$this->supportsClass($class)) { 
466-  throw new UnsupportedUserException( 
467-  sprintf( 
468-  'Instances of "%s" are not supported.', 
469-  $class 
470-  ) 
471-  ); 
472-  } 
473- 
474-  return $this->find($user->getId()); 
475-  } 
476- 
477-  public function supportsClass($class) 
478-  { 
479-  return $this->getEntityName() === $class 
480-  || is_subclass_of($class, $this->getEntityName()); 
481-  } 
482459 } 
483460
484- For more details on these methods, see :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserProviderInterface `.
461+ .. versionadded :: 2.8 
462+  The :class: `Symfony\\ Bridge\\ Doctrine\\ Security\\ User\\ UserLoaderInterface `
463+  interface was introduced in 2.8. Prior to Symfony 2.8, you had to implement
464+  ``Symfony\Component\Security\Core\User\UserProviderInterface ``.
485465
486466.. tip ::
487467
0 commit comments