1 | <?php |
||
9 | class OAuthPackage implements RegistrationInterface |
||
10 | { |
||
11 | /** |
||
12 | * @param Container $c |
||
13 | */ |
||
14 | public function addToContainer(Container $c) |
||
15 | { |
||
16 | // AccessToken |
||
17 | 1 | $function = function ($c) { |
|
18 | /** @var EntityManager $entityManager */ |
||
19 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
20 | 1 | $repository = $entityManager->getRepository('OAuth\AccessToken'); |
|
21 | 1 | return $repository; |
|
22 | 1 | }; |
|
23 | 1 | $c['repository.AccessToken'] = $c->factory($function); |
|
24 | |||
25 | // AuthCode |
||
26 | 1 | $function = function ($c) { |
|
27 | /** @var EntityManager $entityManager */ |
||
28 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
29 | 1 | $repository = $entityManager->getRepository('OAuth\AuthCode'); |
|
30 | 1 | return $repository; |
|
31 | 1 | }; |
|
32 | 1 | $c['repository.AuthCode'] = $c->factory($function); |
|
33 | |||
34 | // Client |
||
35 | 1 | $function = function ($c) { |
|
36 | /** @var EntityManager $entityManager */ |
||
37 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
38 | 1 | $repository = $entityManager->getRepository('OAuth\Client'); |
|
39 | 1 | return $repository; |
|
40 | 1 | }; |
|
41 | 1 | $c['repository.Client'] = $c->factory($function); |
|
42 | |||
43 | // RefreshToken |
||
44 | 1 | $function = function ($c) { |
|
45 | /** @var EntityManager $entityManager */ |
||
46 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
47 | 1 | $repository = $entityManager->getRepository('OAuth\RefreshToken'); |
|
48 | 1 | return $repository; |
|
49 | 1 | }; |
|
50 | 1 | $c['repository.RefreshToken'] = $c->factory($function); |
|
51 | |||
52 | // Scope |
||
53 | 1 | $function = function ($c) { |
|
54 | /** @var EntityManager $entityManager */ |
||
55 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
56 | 1 | $repository = $entityManager->getRepository('OAuth\Scope'); |
|
57 | 1 | return $repository; |
|
58 | 1 | }; |
|
59 | 1 | $c['repository.Scope'] = $c->factory($function); |
|
60 | |||
61 | // User |
||
62 | 1 | $function = function ($c) { |
|
63 | /** @var EntityManager $entityManager */ |
||
64 | 1 | $entityManager = $c['doctrine.entity_manager']; |
|
65 | 1 | $repository = $entityManager->getRepository('OAuth\User'); |
|
66 | return $repository; |
||
67 | 1 | }; |
|
68 | 1 | $c['repository.User'] = $c->factory($function); |
|
69 | |||
70 | |||
71 | 1 | } |
|
72 | |||
73 | 1 | public function getEntityPath() |
|
77 | |||
78 | 1 | public function hasEntityPath() |
|
82 | |||
83 | } |