52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Krzysiej\RyobiCrawler;
|
|
|
|
use Krzysiej\RyobiCrawler\Twig\AppExtension;
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
|
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
|
use Twig\Extra\Cache\CacheExtension;
|
|
use Twig\Extra\Cache\CacheRuntime;
|
|
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
|
|
|
class Kernel extends BaseKernel
|
|
{
|
|
use MicroKernelTrait;
|
|
|
|
public function registerBundles(): iterable
|
|
{
|
|
return [
|
|
new FrameworkBundle(),
|
|
new TwigBundle(),
|
|
new TwigExtraBundle(),
|
|
];
|
|
}
|
|
|
|
protected function configureContainer(ContainerConfigurator $container): void
|
|
{
|
|
$container->extension('framework', [
|
|
'secret' => 'S0ME_SECRET'
|
|
]);
|
|
$services = $container->services()->defaults()->autowire()->autoconfigure();
|
|
$services->load('Krzysiej\\RyobiCrawler\\', __DIR__ )
|
|
->exclude('../src/{Models,Twig,Kernel.php}');
|
|
$services->set('twig.extension.cache', AppExtension::class)->tag('twig.extension');
|
|
$services->set(CacheExtension::class)->tag('twig.extension');
|
|
$services->set(FilesystemAdapter::class)->args([
|
|
'$directory' => __DIR__ . '/../var/cache/twig_blocks'
|
|
]);
|
|
$services->set('twig.runtime.cache', CacheRuntime::class)->args([new Reference(FilesystemAdapter::class)])->tag('twig.runtime');
|
|
}
|
|
|
|
protected function configureRoutes(RoutingConfigurator $routes): void
|
|
{
|
|
$routes->import(__DIR__ . '/Controller/', 'attribute');
|
|
}
|
|
}
|