@@ -433,30 +433,19 @@ interface requires three methods: ``loadUserByUsername($username)``,
433
433
434
434
use Symfony\Component\Security\Core\User\UserInterface;
435
435
use Symfony\Component\Security\Core\User\UserProviderInterface;
436
- use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
437
436
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
438
437
use Doctrine\ORM\EntityRepository;
439
438
440
439
class UserRepository extends EntityRepository implements UserProviderInterface
441
440
{
442
441
public function loadUserByUsername($username)
443
442
{
444
- $user = $this->createQueryBuilder('u')
443
+ return $this->createQueryBuilder('u')
445
444
->where('u.username = :username OR u.email = :email')
446
445
->setParameter('username', $username)
447
446
->setParameter('email', $username)
448
447
->getQuery()
449
448
->getOneOrNullResult();
450
-
451
- if (null === $user) {
452
- $message = sprintf(
453
- 'Unable to find an active admin AppBundle:User object identified by "%s".',
454
- $username
455
- );
456
- throw new UsernameNotFoundException($message);
457
- }
458
-
459
- return $user;
460
449
}
461
450
462
451
public function refreshUser(UserInterface $user)