55
66class AppKernel extends Kernel
77{
8+ /** @var string[] */
9+ protected $ bundleClasses ;
10+
11+ /**
12+ * @param string $environment
13+ * @param bool $debug
14+ * @param string[] $bundleClasses
15+ */
16+ public function __construct ($ environment , $ debug , array $ bundleClasses = [])
17+ {
18+ parent ::__construct ($ environment , $ debug );
19+
20+ $ this ->bundleClasses = $ bundleClasses ;
21+ }
22+
823 public function registerBundles ()
924 {
10- $ bundles = [
25+ $ bundles = array (
1126 new Symfony \Bundle \FrameworkBundle \FrameworkBundle (),
12- new Symfony \Bundle \SecurityBundle \SecurityBundle (),
1327 new Symfony \Bundle \TwigBundle \TwigBundle (),
14- new Symfony \Bundle \MonologBundle \MonologBundle (),
15- new Symfony \Bundle \SwiftmailerBundle \SwiftmailerBundle (),
16- new Doctrine \Bundle \DoctrineBundle \DoctrineBundle (),
1728 new Sensio \Bundle \FrameworkExtraBundle \SensioFrameworkExtraBundle (),
18- new PHPBenchmarks \BenchmarkBundle \BenchmarkBundle ()
19- ];
29+ );
30+ foreach ($ this ->bundleClasses as $ bundleClass ) {
31+ $ bundles [] = new $ bundleClass ();
32+ }
2033
2134 return $ bundles ;
2235 }
@@ -28,16 +41,16 @@ public function getRootDir()
2841
2942 public function getCacheDir ()
3043 {
31- return dirname (__DIR__ ). '/var/cache/ ' . $ this ->getEnvironment ();
44+ return dirname (__DIR__ ) . '/var/cache/ ' . $ this ->getEnvironment ();
3245 }
3346
3447 public function getLogDir ()
3548 {
36- return dirname (__DIR__ ). '/var/logs ' ;
49+ return dirname (__DIR__ ) . '/var/logs ' ;
3750 }
3851
3952 public function registerContainerConfiguration (LoaderInterface $ loader )
4053 {
41- $ loader ->load ($ this ->getRootDir (). '/config/config_ ' . $ this ->getEnvironment (). '.yml ' );
54+ $ loader ->load ($ this ->getRootDir () . '/config/config_ ' . $ this ->getEnvironment () . '.yml ' );
4255 }
4356}
0 commit comments