1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace App ;
4
6
5
7
use Symfony \Bundle \FrameworkBundle \Kernel \MicroKernelTrait ;
@@ -13,31 +15,35 @@ class Kernel extends BaseKernel
13
15
14
16
protected function configureContainer (ContainerConfigurator $ container ): void
15
17
{
16
- $ container -> import ( ' ../config/{packages}/*.php ' );
17
- $ container -> import ( ' ../config/{packages}/*.yaml ' );
18
- $ container ->import (' ../config/ {packages}/' . $ this -> environment . ' /*. php ' );
19
- $ container ->import (' ../config/ {packages}/ ' .$ this ->environment .'/*.yaml ' );
20
-
21
- if (\ is_file (\dirname ( __DIR__ ). ' /config /services.yaml ' )) {
22
- $ container ->import (' ../config /services.yaml ' );
23
- $ container ->import (' ../config /{services}_ ' .$ this ->environment .'.yaml ' );
24
- } elseif ( \is_file ( $ path = \dirname ( __DIR__ ). ' /config/services.php ' )) {
25
- ( require $ path )( $ container ->withPath ( $ path ), $ this );
26
- $ container ->import (' ../config /{services}_ ' .$ this ->environment .'.php ' );
18
+ $ configDir = $ this -> getConfigDir ( );
19
+
20
+ $ container ->import ($ configDir . ' / {packages}/*.{ php,yaml} ' );
21
+ $ container ->import ($ configDir . ' / {packages}/ ' .$ this ->environment .'/*.{php, yaml} ' );
22
+
23
+ if (is_file ($ configDir . ' /services.yaml ' )) {
24
+ $ container ->import ($ configDir . ' /services.yaml ' );
25
+ $ container ->import ($ configDir . ' /{services}_ ' .$ this ->environment .'.yaml ' );
26
+ } else {
27
+ $ container ->import ( $ configDir . ' /{services}.php ' );
28
+ $ container ->import ($ configDir . ' /{services}_ ' .$ this ->environment .'.php ' );
27
29
}
28
30
}
29
31
30
32
protected function configureRoutes (RoutingConfigurator $ routes ): void
31
33
{
32
- $ routes ->import ('../config/{routes}/ ' .$ this ->environment .'/*.php ' );
33
- $ routes ->import ('../config/{routes}/ ' .$ this ->environment .'/*.yaml ' );
34
- $ routes ->import ('../config/{routes}/*.php ' );
35
- $ routes ->import ('../config/{routes}/*.yaml ' );
36
-
37
- if (\is_file (\dirname (__DIR__ ).'/config/routes.yaml ' )) {
38
- $ routes ->import ('../config/routes.yaml ' );
39
- } elseif (\is_file ($ path = \dirname (__DIR__ ).'/config/routes.php ' )) {
40
- (require $ path )($ routes ->withPath ($ path ), $ this );
34
+ $ configDir = $ this ->getConfigDir ();
35
+
36
+ $ routes ->import ($ configDir .'/{routes}/ ' .$ this ->environment .'/*.{php,yaml} ' );
37
+ $ routes ->import ($ configDir .'/{routes}/*.{php,yaml} ' );
38
+
39
+ if (is_file ($ configDir .'/routes.yaml ' )) {
40
+ $ routes ->import ($ configDir .'/routes.yaml ' );
41
+ } else {
42
+ $ routes ->import ($ configDir .'/{routes}.php ' );
43
+ }
44
+
45
+ if (false !== ($ fileName = (new \ReflectionObject ($ this ))->getFileName ())) {
46
+ $ routes ->import ($ fileName , 'annotation ' );
41
47
}
42
48
}
43
49
}
0 commit comments