1 | <?php |
||
10 | class ContainerService |
||
11 | { |
||
12 | /** |
||
13 | * @var PimpleContainer |
||
14 | */ |
||
15 | private $container; |
||
16 | |||
17 | /** |
||
18 | * @var DbCredentials |
||
19 | */ |
||
20 | private $credentials; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $paths; |
||
26 | |||
27 | public function __construct(){} |
||
29 | |||
30 | 5 | public static function getInstance() |
|
31 | { |
||
32 | 5 | static $inst = null; |
|
33 | 5 | if($inst === null) |
|
34 | 5 | { |
|
35 | 1 | $inst = new ContainerService(); |
|
36 | 1 | $inst->container = new PimpleContainer(); |
|
37 | 1 | $inst->paths = ['src/Entity']; |
|
38 | 1 | } |
|
39 | 5 | return $inst; |
|
40 | } |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @return PimpleContainer |
||
45 | */ |
||
46 | 3 | public function getContainer() |
|
68 | |||
69 | |||
70 | |||
71 | /** |
||
72 | * @param string $path |
||
73 | * @return $this |
||
74 | */ |
||
75 | 2 | public function addEntityPath($path) |
|
76 | { |
||
77 | 2 | $this->paths[] = $path; |
|
78 | 2 | return $this; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return array |
||
83 | */ |
||
84 | 4 | public function getEntityPaths() |
|
88 | |||
89 | /** |
||
90 | * @return DbCredentials |
||
91 | */ |
||
92 | 4 | public function getDbCredentials() |
|
96 | |||
97 | /** |
||
98 | * @param DbCredentials $credentials |
||
99 | * @return $this |
||
100 | */ |
||
101 | 2 | public function setDbCredentials(DbCredentials $credentials) |
|
106 | |||
107 | |||
108 | public function registerToContainer(RegistrationInterface $config) |
||
115 | } |
||
116 |