-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAppKernel.php
71 lines (59 loc) · 2.1 KB
/
AppKernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
abstract class AppKernel extends Kernel
{
/**
* Returns unique app name
* @return string
*/
abstract public function getAppName();
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' . $this->getAppName() . '/' . $this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__) . '/var/logs/' . $this->getAppName();
}
protected function getKernelParameters()
{
$parameters = parent::getKernelParameters();
return array_merge_recursive($parameters, [
'kernel.multiple_root_dir' => $parameters['kernel.root_dir'] . '/config/' . $this->getAppName(),
'kernel.app_name' => $this->getAppName(),
]);
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$configurationPath = sprintf(
'%s/config/%s/config_%s.yml',
$this->getRootDir(),
$this->getAppName(),
$this->getEnvironment()
);
$loader->load($configurationPath);
}
}