/
Kernel.php
125 lines (106 loc) · 3.78 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
declare(strict_types=1);
/*
* This file is part of the Runroom package.
*
* (c) Runroom <runroom@runroom.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Runroom\BasicPageBundle\Tests\App;
use A2lix\AutoFormBundle\A2lixAutoFormBundle;
use A2lix\TranslationFormBundle\A2lixTranslationFormBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle;
use FOS\CKEditorBundle\FOSCKEditorBundle;
use Knp\Bundle\MenuBundle\KnpMenuBundle;
use Knp\DoctrineBehaviors\DoctrineBehaviorsBundle;
use Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle;
use Runroom\BasicPageBundle\RunroomBasicPageBundle;
use Runroom\BasicPageBundle\Tests\App\Entity\Media;
use Runroom\RenderEventBundle\RunroomRenderEventBundle;
use Runroom\SeoBundle\RunroomSeoBundle;
use Sonata\AdminBundle\SonataAdminBundle;
use Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
public function registerBundles(): iterable
{
return [
new A2lixAutoFormBundle(),
new A2lixTranslationFormBundle(),
new DoctrineBehaviorsBundle(),
new DoctrineBundle(),
new FidryAliceDataFixturesBundle(),
new FOSCKEditorBundle(),
new FrameworkBundle(),
new KnpMenuBundle(),
new NelmioAliceBundle(),
new SecurityBundle(),
new SonataAdminBundle(),
new SonataDoctrineORMAdminBundle(),
new TwigBundle(),
new RunroomBasicPageBundle(),
new RunroomRenderEventBundle(),
new RunroomSeoBundle(),
];
}
public function getCacheDir(): string
{
return $this->getBaseDir() . '/cache';
}
public function getLogDir(): string
{
return $this->getBaseDir() . '/log';
}
public function getProjectDir(): string
{
return __DIR__;
}
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void
{
$c->setParameter('kernel.default_locale', 'en');
$c->loadFromExtension('framework', [
'test' => true,
'router' => ['utf8' => true],
'secret' => 'secret',
]);
$c->loadFromExtension('security', [
'firewalls' => ['main' => ['anonymous' => true]],
]);
$c->loadFromExtension('doctrine', [
'dbal' => ['url' => 'sqlite://:memory:', 'logging' => false],
'orm' => ['auto_mapping' => true],
]);
$c->loadFromExtension('twig', [
'exception_controller' => null,
'strict_variables' => '%kernel.debug%',
]);
$c->loadFromExtension('a2lix_translation_form', [
'locales' => ['es', 'en', 'ca'],
]);
$c->loadFromExtension('runroom_seo', [
'locales' => ['es', 'en', 'ca'],
'xdefault_locale' => 'es',
'class' => ['media' => Media::class],
]);
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$routes->import($this->getProjectDir() . '/routing.yaml');
}
private function getBaseDir(): string
{
return sys_get_temp_dir() . '/runroom-basic-page-bundle/var';
}
}