Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (48 sloc) 2.13 KB
<?php declare(strict_types=1);
namespace Fop\Core\HttpKernel;
use Iterator;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symplify\AutoBindParameter\DependencyInjection\CompilerPass\AutoBindParameterCompilerPass;
use Symplify\Autodiscovery\Discovery;
use Symplify\AutowireArrayParameter\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\FlexLoader\Flex\FlexLoader;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutoReturnFactoryCompilerPass;
final class FopKernel extends Kernel
{
use MicroKernelTrait;
private FlexLoader $flexLoader;
private Discovery $discovery;
public function __construct(string $environment, bool $debug)
{
parent::__construct($environment, $debug);
$this->flexLoader = new FlexLoader($environment, $this->getProjectDir());
$this->discovery = new Discovery($this->getProjectDir());
}
public function registerBundles(): Iterator
{
return $this->flexLoader->loadBundles();
}
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
{
$this->discovery->discoverTemplates($containerBuilder);
$this->flexLoader->loadConfigs($containerBuilder, $loader, [
// project packages
$this->getProjectDir() . '/packages/*/config/*',
]);
}
protected function configureRoutes(RouteCollectionBuilder $routeCollectionBuilder): void
{
$this->discovery->discoverRoutes($routeCollectionBuilder);
$this->flexLoader->loadRoutes($routeCollectionBuilder);
}
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new AutoReturnFactoryCompilerPass());
$containerBuilder->addCompilerPass(new AutoBindParameterCompilerPass());
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
}
}
You can’t perform that action at this time.