File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use PhpGitHooks \Infrastructure \CommandBus \CommandBus \CommandBusCompilerPass ;
4
+ use PhpGitHooks \Infrastructure \CommandBus \QueryBus \QueryBusCompilerPass ;
5
+ use Symfony \Component \Config \FileLocator ;
6
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
7
+ use Symfony \Component \DependencyInjection \Loader \YamlFileLoader ;
8
+
9
+ class AppKernel
10
+ {
11
+ const SERVICES_FILE = 'services.yml ' ;
12
+ const CONFIG_PATH = '/config/ ' ;
13
+
14
+ /**
15
+ * @var ContainerBuilder
16
+ */
17
+ private $ container ;
18
+
19
+ public function __construct ()
20
+ {
21
+ $ this ->container = new ContainerBuilder ();
22
+ $ this ->container ->addCompilerPass (new CommandBusCompilerPass ());
23
+ $ this ->container ->addCompilerPass (new QueryBusCompilerPass ());
24
+ $ this ->getConfigServices ();
25
+ $ this ->container ->compile ();
26
+ }
27
+
28
+ private function getConfigServices ()
29
+ {
30
+ $ loader = new YamlFileLoader ($ this ->container , new FileLocator (__DIR__ .self ::CONFIG_PATH ));
31
+ $ loader ->load (self ::SERVICES_FILE );
32
+ }
33
+
34
+ /**
35
+ * @param string $serviceName
36
+ *
37
+ * @return object
38
+ */
39
+ public function get ($ serviceName )
40
+ {
41
+ return $ this ->container ->get ($ serviceName );
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments