File tree 1 file changed +1
-12
lines changed
1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -432,29 +432,18 @@ interface only requires one method: ``loadUserByUsername($username)``::
432
432
433
433
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
434
434
use Symfony\Component\Security\Core\User\UserInterface;
435
- use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
436
435
use Doctrine\ORM\EntityRepository;
437
436
438
437
class UserRepository extends EntityRepository implements UserLoaderInterface
439
438
{
440
439
public function loadUserByUsername($username)
441
440
{
442
- $user = $this->createQueryBuilder('u')
441
+ return $this->createQueryBuilder('u')
443
442
->where('u.username = :username OR u.email = :email')
444
443
->setParameter('username', $username)
445
444
->setParameter('email', $username)
446
445
->getQuery()
447
446
->getOneOrNullResult();
448
-
449
- if (null === $user) {
450
- $message = sprintf(
451
- 'Unable to find an active admin AppBundle:User object identified by "%s".',
452
- $username
453
- );
454
- throw new UsernameNotFoundException($message);
455
- }
456
-
457
- return $user;
458
447
}
459
448
}
460
449
You can’t perform that action at this time.
0 commit comments