|
5 | 5 |
|
6 | 6 | class AppKernel extends Kernel |
7 | 7 | { |
| 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 | + |
8 | 23 | public function registerBundles() |
9 | 24 | { |
10 | 25 | $bundles = array( |
11 | 26 | new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
12 | | - new Symfony\Bundle\SecurityBundle\SecurityBundle(), |
13 | 27 | new Symfony\Bundle\TwigBundle\TwigBundle(), |
14 | | - new Symfony\Bundle\MonologBundle\MonologBundle(), |
15 | | - new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), |
16 | | - new Symfony\Bundle\AsseticBundle\AsseticBundle(), |
17 | | - new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
18 | 28 | new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
19 | | - new PHPBenchmarks\BenchmarkBundle\BenchmarkBundle() |
20 | 29 | ); |
21 | | - |
22 | | - if (in_array($this->getEnvironment(), array('dev'))) { |
23 | | - $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); |
24 | | - $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); |
25 | | - $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); |
| 30 | + foreach ($this->bundleClasses as $bundleClass) { |
| 31 | + $bundles[] = new $bundleClass(); |
26 | 32 | } |
27 | 33 |
|
28 | 34 | return $bundles; |
29 | 35 | } |
30 | 36 |
|
31 | 37 | public function registerContainerConfiguration(LoaderInterface $loader) |
32 | 38 | { |
33 | | - $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); |
| 39 | + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); |
34 | 40 | } |
35 | 41 | } |
0 commit comments