1 | <?php |
||
10 | class DoctrineManagerRegistry |
||
11 | implements ManagerRegistry |
||
|
|||
12 | { |
||
13 | protected $managers; |
||
14 | protected $connections; |
||
15 | protected $defaultManager; |
||
16 | protected $defaultConnection; |
||
17 | protected $name; |
||
18 | |||
19 | public function __construct($name, array $connections, array $managers, $defaultConnection = 'default', $defaultManager = 'default') |
||
20 | { |
||
21 | $this->name = $name; |
||
22 | $this->managers = $managers; |
||
23 | $this->connections = $connections; |
||
24 | $this->defaultManager = $defaultManager; |
||
25 | $this->defaultConnection = $defaultConnection; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * {@inheritDoc} |
||
30 | */ |
||
31 | public function getDefaultConnectionName() |
||
32 | { |
||
33 | return $this->defaultConnection; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritDoc} |
||
38 | */ |
||
39 | public function getConnection($name = null) |
||
40 | { |
||
41 | if ($name === null) { |
||
42 | $name = $this->getDefaultConnectionName(); |
||
43 | } |
||
44 | |||
45 | return $this->connections[$name]; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritDoc} |
||
50 | */ |
||
51 | public function getConnections() |
||
52 | { |
||
53 | return $this->connections; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * {@inheritDoc} |
||
58 | */ |
||
59 | public function getConnectionNames() |
||
60 | { |
||
61 | array_keys($this->connections); |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritDoc} |
||
66 | */ |
||
67 | public function getDefaultManagerName() |
||
68 | { |
||
69 | return $this->defaultManager; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritDoc} |
||
74 | */ |
||
75 | public function getManager($name = null) |
||
76 | { |
||
77 | if ($name === null) { |
||
78 | $name = $this->getDefaultManagerName(); |
||
79 | } |
||
80 | |||
81 | return $this->managers[$name]; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * {@inheritDoc} |
||
86 | */ |
||
87 | public function getManagers() |
||
88 | { |
||
89 | return $this->managers; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * {@inheritDoc} |
||
94 | */ |
||
95 | public function getAliasNamespace() |
||
96 | { |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | public function resetManager() |
||
103 | { |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritDoc} |
||
108 | */ |
||
109 | public function getManagerNames() |
||
110 | { |
||
111 | return array_keys($this->managers); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * {@inheritDoc} |
||
116 | */ |
||
117 | public function getRepository($persistentObject, $persistentManagerName = null) |
||
118 | { |
||
119 | $this->getManager($persistentManagerName)->getRepository($persistentObject); |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * {@inheritDoc} |
||
124 | */ |
||
125 | public function getManagerForClass($class) |
||
136 | } |
||
137 |