Skip to content

Commit fc8e495

Browse files
committed
BugFix: Doctrine class calling
1 parent 4a0347f commit fc8e495

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Barnetik/DoctrineAuth/DoctrineUserProvider.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
*/
1111
class DoctrineUserProvider implements UserProvider
1212
{
13+
private $em;
1314
private $userMapper;
14-
15+
1516
public function __construct(EntityManagerInterface $entityManager, $model) {
17+
$this->em = $entityManager;
1618
$this->userMapper = $entityManager->getRepository($model);
1719
}
1820

1921
public function retrieveById($identifier) {
2022
return $this->userMapper->find($identifier);
2123
}
22-
24+
2325
public function retrieveByCredentials(array $credentials) {
2426
$criteria = [];
2527
foreach ($credentials as $key => $value) {
@@ -29,24 +31,24 @@ public function retrieveByCredentials(array $credentials) {
2931
}
3032
return $this->userMapper->findOneBy($criteria);
3133
}
32-
34+
3335
public function validateCredentials(UserContract $user, array $credentials) {
3436
$userPass = $user->getAuthPassword();
3537
$pass = $credentials['password'];
3638
return password_verify($pass, $userPass);
3739
}
38-
40+
3941
public function retrieveByToken($identifier, $token) {
4042
return $this->userMapper->findOneBy([
4143
"id" => $identifier,
4244
"rememberToken" => $token
4345
]);
4446
}
45-
47+
4648
public function updateRememberToken(UserContract $user, $token) {
4749
$user->setRememberToken($token);
48-
\Doctrine::persist($user);
49-
\Doctrine::flush();
50+
$this->em->persist($user);
51+
$this->em->flush();
5052
}
51-
53+
5254
}

0 commit comments

Comments
 (0)