Skip to content

Commit 3d2a16e

Browse files
committed
Merge pull request #336 from garak/patch-1
Defer getRepository
2 parents 258521e + 784ca98 commit 3d2a16e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Entity/AuthCodeManager.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ class AuthCodeManager extends BaseAuthCodeManager
2222
*/
2323
protected $em;
2424

25-
/**
26-
* @var \Doctrine\ORM\EntityRepository
27-
*/
28-
protected $repository;
29-
3025
/**
3126
* @var string
3227
*/
@@ -39,7 +34,6 @@ class AuthCodeManager extends BaseAuthCodeManager
3934
public function __construct(EntityManager $em, $class)
4035
{
4136
$this->em = $em;
42-
$this->repository = $em->getRepository($class);
4337
$this->class = $class;
4438
}
4539

@@ -56,7 +50,7 @@ public function getClass()
5650
*/
5751
public function findAuthCodeBy(array $criteria)
5852
{
59-
return $this->repository->findOneBy($criteria);
53+
return $this->em->getRepository($this->class)->findOneBy($criteria);
6054
}
6155

6256
/**
@@ -82,7 +76,7 @@ public function deleteAuthCode(AuthCodeInterface $authCode)
8276
*/
8377
public function deleteExpired()
8478
{
85-
$qb = $this->repository->createQueryBuilder('a');
79+
$qb = $this->em->getRepository($this->class)->createQueryBuilder('a');
8680
$qb
8781
->delete()
8882
->where('a.expiresAt < ?1')

0 commit comments

Comments
 (0)