/
Kernel.php
67 lines (53 loc) · 1.79 KB
/
Kernel.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
<?php
require_once __DIR__.'/../src/autoload.php';
use Symfony\Framework\Kernel;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader as ContainerLoader;
use Symfony\Components\Routing\Loader\XmlFileLoader as RoutingLoader;
use Symfony\Components\DependencyInjection\ContainerBuilder;
use Symfony\Framework\Bundle\KernelBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\ZendBundle\ZendBundle;
use Symfony\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
class {{ class }}Kernel extends Kernel
{
public function registerRootDir()
{
return __DIR__;
}
public function registerBundles()
{
$bundles = array(
new KernelBundle(),
new FrameworkBundle(),
// enable third-party bundles
new ZendBundle(),
new DoctrineBundle(),
new SwiftmailerBundle(),
// register your bundles here
);
if ($this->isDebug()) {
}
return $bundles;
}
public function registerBundleDirs()
{
return array(
'Application' => __DIR__.'/../src/Application',
'Bundle' => __DIR__.'/../src/Bundle',
'Symfony\\Bundle' => __DIR__.'/../src/vendor/Symfony/src/Symfony/Bundle',
);
}
public function registerContainerConfiguration()
{
$container = new ContainerBuilder();
$loader = new ContainerLoader($container, $this->getBundleDirs());
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.xml');
return $container;
}
public function registerRoutes()
{
$loader = new RoutingLoader($this->getBundleDirs());
return $loader->load(__DIR__.'/config/routing.xml');
}
}