1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Zenstruck\Foundry\Test; |
4
|
|
|
|
5
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @internal |
9
|
|
|
* |
10
|
|
|
* @author Kevin Bond <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
final class LazyManagerRegistry implements ManagerRegistry |
13
|
|
|
{ |
14
|
|
|
private $callback; |
15
|
|
|
|
16
|
427 |
|
public function __construct(callable $callback) |
17
|
|
|
{ |
18
|
427 |
|
$this->callback = $callback; |
19
|
427 |
|
} |
20
|
|
|
|
21
|
|
|
public function getDefaultConnectionName() |
22
|
|
|
{ |
23
|
|
|
return $this->inner()->getDefaultConnectionName(); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getConnection($name = null) |
27
|
|
|
{ |
28
|
|
|
return $this->inner()->getConnection($name); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function getConnections() |
32
|
|
|
{ |
33
|
|
|
return $this->inner()->getConnections(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getConnectionNames() |
37
|
|
|
{ |
38
|
|
|
return $this->inner()->getConnectionNames(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getDefaultManagerName() |
42
|
|
|
{ |
43
|
|
|
return $this->inner()->getDefaultManagerName(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getManager($name = null) |
47
|
|
|
{ |
48
|
|
|
return $this->inner()->getManager($name); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getManagers() |
52
|
|
|
{ |
53
|
|
|
return $this->inner()->getManagers(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function resetManager($name = null) |
57
|
|
|
{ |
58
|
|
|
return $this->inner()->resetManager($name); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getAliasNamespace($alias) |
62
|
|
|
{ |
63
|
|
|
return $this->inner()->getAliasNamespace($alias); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getManagerNames() |
67
|
|
|
{ |
68
|
|
|
return $this->inner()->getManagerNames(); |
69
|
|
|
} |
70
|
|
|
|
71
|
120 |
|
public function getRepository($persistentObject, $persistentManagerName = null) |
72
|
|
|
{ |
73
|
120 |
|
return $this->inner()->getRepository($persistentObject, $persistentManagerName); |
74
|
|
|
} |
75
|
|
|
|
76
|
169 |
|
public function getManagerForClass($class) |
77
|
|
|
{ |
78
|
169 |
|
return $this->inner()->getManagerForClass($class); |
79
|
|
|
} |
80
|
|
|
|
81
|
205 |
|
private function inner(): ManagerRegistry |
82
|
|
|
{ |
83
|
205 |
|
return ($this->callback)(); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|