File tree 2 files changed +3
-25
lines changed
2 files changed +3
-25
lines changed Original file line number Diff line number Diff line change 14
14
namespace FOS \OAuthServerBundle \Entity ;
15
15
16
16
use Doctrine \ORM \EntityManagerInterface ;
17
- use Doctrine \ORM \EntityRepository ;
18
17
use FOS \OAuthServerBundle \Model \ClientInterface ;
19
18
use FOS \OAuthServerBundle \Model \ClientManager as BaseClientManager ;
20
19
@@ -25,24 +24,14 @@ class ClientManager extends BaseClientManager
25
24
*/
26
25
protected $ em ;
27
26
28
- /**
29
- * @var EntityRepository
30
- */
31
- protected $ repository ;
32
-
33
27
/**
34
28
* @var string
35
29
*/
36
30
protected $ class ;
37
31
38
32
public function __construct (EntityManagerInterface $ em , $ class )
39
33
{
40
- // NOTE: bug in Doctrine, hinting EntityRepository|ObjectRepository when only EntityRepository is expected
41
- /** @var EntityRepository $repository */
42
- $ repository = $ em ->getRepository ($ class );
43
-
44
34
$ this ->em = $ em ;
45
- $ this ->repository = $ repository ;
46
35
$ this ->class = $ class ;
47
36
}
48
37
@@ -59,7 +48,7 @@ public function getClass()
59
48
*/
60
49
public function findClientBy (array $ criteria )
61
50
{
62
- return $ this ->repository ->findOneBy ($ criteria );
51
+ return $ this ->em -> getRepository ( $ this -> class ) ->findOneBy ($ criteria );
63
52
}
64
53
65
54
/**
Original file line number Diff line number Diff line change 14
14
namespace FOS \OAuthServerBundle \Entity ;
15
15
16
16
use Doctrine \ORM \EntityManagerInterface ;
17
- use Doctrine \ORM \EntityRepository ;
18
17
use FOS \OAuthServerBundle \Model \TokenInterface ;
19
18
use FOS \OAuthServerBundle \Model \TokenManager as BaseTokenManager ;
20
19
@@ -25,24 +24,14 @@ class TokenManager extends BaseTokenManager
25
24
*/
26
25
protected $ em ;
27
26
28
- /**
29
- * @var EntityRepository
30
- */
31
- protected $ repository ;
32
-
33
27
/**
34
28
* @var string
35
29
*/
36
30
protected $ class ;
37
31
38
32
public function __construct (EntityManagerInterface $ em , $ class )
39
33
{
40
- // NOTE: bug in Doctrine, hinting EntityRepository|ObjectRepository when only EntityRepository is expected
41
- /** @var EntityRepository $repository */
42
- $ repository = $ em ->getRepository ($ class );
43
-
44
34
$ this ->em = $ em ;
45
- $ this ->repository = $ repository ;
46
35
$ this ->class = $ class ;
47
36
}
48
37
@@ -59,7 +48,7 @@ public function getClass()
59
48
*/
60
49
public function findTokenBy (array $ criteria )
61
50
{
62
- return $ this ->repository ->findOneBy ($ criteria );
51
+ return $ this ->em -> getRepository ( $ this -> class ) ->findOneBy ($ criteria );
63
52
}
64
53
65
54
/**
@@ -85,7 +74,7 @@ public function deleteToken(TokenInterface $token)
85
74
*/
86
75
public function deleteExpired ()
87
76
{
88
- $ qb = $ this ->repository ->createQueryBuilder ('t ' );
77
+ $ qb = $ this ->em -> getRepository ( $ this -> class ) ->createQueryBuilder ('t ' );
89
78
$ qb
90
79
->delete ()
91
80
->where ('t.expiresAt < ?1 ' )
You can’t perform that action at this time.
0 commit comments