Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f7adcfa

Browse filesBrowse files
committed
minor #6228 removed unnecessary exception from repository (gondo)
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #6228). Discussion ---------- removed unnecessary exception from repository removed `UsernameNotFoundException` form repository as this logic does not belong to repository and also it is duplicated. exception is already thrown on proper place if no user is found: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php#L60 Commits ------- 0e288a2 removed unnecesary exception form repository
2 parents ab57eed + 0e288a2 commit f7adcfa
Copy full SHA for f7adcfa

File tree

Expand file treeCollapse file tree

1 file changed

+1
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-12
lines changed

‎cookbook/security/entity_provider.rst

Copy file name to clipboardExpand all lines: cookbook/security/entity_provider.rst
+1-12Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,29 +432,18 @@ interface only requires one method: ``loadUserByUsername($username)``::
432432

433433
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
434434
use Symfony\Component\Security\Core\User\UserInterface;
435-
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
436435
use Doctrine\ORM\EntityRepository;
437436

438437
class UserRepository extends EntityRepository implements UserLoaderInterface
439438
{
440439
public function loadUserByUsername($username)
441440
{
442-
$user = $this->createQueryBuilder('u')
441+
return $this->createQueryBuilder('u')
443442
->where('u.username = :username OR u.email = :email')
444443
->setParameter('username', $username)
445444
->setParameter('email', $username)
446445
->getQuery()
447446
->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;
458447
}
459448
}
460449

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.