Skip to content

Commit e2cc24d

Browse files
committed
Restructured code after PR comments. Changed PHPDOC for interface.
1 parent 18d553f commit e2cc24d

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,15 @@ public function loadUserByUsername($username)
5454
if (null !== $this->property) {
5555
$user = $this->repository->findOneBy(array($this->property => $username));
5656
} else {
57-
if (!($this->repository instanceof UserLoaderInterface
58-
|| $this->repository instanceof UserProviderInterface)
59-
) {
60-
throw new \InvalidArgumentException(sprintf(
61-
'The Doctrine repository "%s" must implement UserLoaderInterface.',
62-
get_class($this->repository)
63-
));
64-
}
65-
66-
if ($this->repository instanceof UserProviderInterface) {
67-
@trigger_error('Implementing loadUserByUsername from Symfony\Component\Security\Core\User\UserProviderInterface is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED);
57+
if (!$this->repository instanceof UserLoaderInterface) {
58+
if (!$this->repository instanceof UserProviderInterface) {
59+
throw new \InvalidArgumentException(sprintf(
60+
'The Doctrine repository "%s" must implement UserLoaderInterface.',
61+
get_class($this->repository)
62+
));
63+
}
64+
65+
@trigger_error('Implementing loadUserByUsername from Symfony\Component\Security\Core\User\UserProviderInterface is deprecated since version 2.8 and will be removed in 3.0. Use the Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED);
6866
}
6967

7068
$user = $this->repository->loadUserByUsername($username);

src/Symfony/Bridge/Doctrine/Security/User/UserLoaderInterface.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@
1515
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1616

1717
/**
18-
* Represents a class that loads UserInterface objects from some source for the authentication system.
18+
* Represents a class that loads UserInterface objects from Doctrine source for the authentication system.
1919
*
20-
* In a typical authentication configuration, a username (i.e. some unique
21-
* user identifier) credential enters the system (via form login, or any
22-
* method). The user provider that is configured with that authentication
23-
* method is asked to load the UserInterface object for the given username
24-
* (via loadUserByUsername) so that the rest of the process can continue.
25-
*
26-
* Internally, a user provider can load users from any source (databases,
27-
* configuration, web service). This is totally independent of how the authentication
28-
* information is submitted or what the UserInterface object looks like.
20+
* This interface is meant to facilitate the loading of a User from Doctrine source using a custom method.
21+
* If you want to implement your own logic of retrieving the user from Doctrine your repository should implement this
22+
* interface.
2923
*
3024
* @see UserInterface
3125
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy