11<?php
22
3+ declare (strict_types=1 );
4+
35namespace App ;
46
57use Symfony \Bundle \FrameworkBundle \Kernel \MicroKernelTrait ;
@@ -13,31 +15,35 @@ class Kernel extends BaseKernel
1315
1416 protected function configureContainer (ContainerConfigurator $ container ): void
1517 {
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 ' );
2729 }
2830 }
2931
3032 protected function configureRoutes (RoutingConfigurator $ routes ): void
3133 {
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 ' );
4147 }
4248 }
4349}
0 commit comments