|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is a part of Sculpin. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Dragonfly Development Inc. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Symplify\PHP7_Sculpin\HttpKernel; |
|
13
|
|
|
|
|
14
|
|
|
use Symplify\PHP7_Sculpin\PostsBundle\SculpinPostsBundle; |
|
15
|
|
|
use Symplify\PHP7_Sculpin\SculpinBundle; |
|
16
|
|
|
use Symplify\PHP7_Sculpin\TwigBundle\SculpinTwigBundle; |
|
17
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
18
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
19
|
|
|
use Symplify\DefaultAutowire\SymplifyDefaultAutowireBundle; |
|
20
|
|
|
|
|
21
|
|
|
final class DefaultKernel extends Kernel |
|
22
|
|
|
{ |
|
23
|
|
|
public function __construct() |
|
24
|
|
|
{ |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* {@inheritdoc} |
|
29
|
|
|
*/ |
|
30
|
|
|
protected function getKernelParameters() |
|
31
|
|
|
{ |
|
32
|
|
|
return array_merge(parent::getKernelParameters(), [ |
|
33
|
|
|
'sculpin.project_dir' => getcwd(), |
|
34
|
|
|
]); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* {@inheritdoc} |
|
39
|
|
|
*/ |
|
40
|
|
|
public function registerBundles() |
|
41
|
|
|
{ |
|
42
|
|
|
$bundles = [ |
|
43
|
|
|
new SymplifyDefaultAutowireBundle(), |
|
44
|
|
|
new SculpinBundle(), |
|
45
|
|
|
new SculpinTwigBundle(), |
|
46
|
|
|
new SculpinPostsBundle(), |
|
47
|
|
|
]; |
|
48
|
|
|
|
|
49
|
|
|
return $bundles; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* {@inheritdoc} |
|
54
|
|
|
*/ |
|
55
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
|
56
|
|
|
{ |
|
57
|
|
|
if (file_exists($file = $this->rootDir.'/config/sculpin_kernel.yml')) { |
|
58
|
|
|
$loader->load($file); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* {@inheritdoc} |
|
64
|
|
|
*/ |
|
65
|
|
|
public function boot() |
|
66
|
|
|
{ |
|
67
|
|
|
if (true === $this->booted) { |
|
68
|
|
|
return; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
parent::boot(); |
|
72
|
|
|
|
|
73
|
|
|
$this->container->compile(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* {@inheritdoc} |
|
78
|
|
|
*/ |
|
79
|
|
|
protected function buildContainer() |
|
80
|
|
|
{ |
|
81
|
|
|
$container = $this->getContainerBuilder(); |
|
82
|
|
|
$container->addObjectResource($this); |
|
83
|
|
|
$this->prepareContainer($container); |
|
84
|
|
|
|
|
85
|
|
|
return $container; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* {@inheritdoc} |
|
90
|
|
|
*/ |
|
91
|
|
|
protected function initializeContainer() |
|
92
|
|
|
{ |
|
93
|
|
|
$container = $this->buildContainer(); |
|
94
|
|
|
$container->set('kernel', $this); |
|
95
|
|
|
$this->container = $container; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|