collection-crud/src/Kernel.php

56 lines
2.0 KiB
PHP
Raw Normal View History

2018-07-18 11:35:27 -04:00
<?php declare(strict_types=1);
2017-11-30 15:06:13 -05:00
2020-06-02 16:08:08 -04:00
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App;
2017-11-30 15:06:13 -05:00
2022-10-13 22:26:33 -04:00
use App\Types\AbstractEnumType;
2017-11-30 15:06:13 -05:00
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
2022-10-13 22:26:33 -04:00
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2020-06-02 16:08:08 -04:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2022-10-13 22:26:33 -04:00
use Symfony\Component\DependencyInjection\ContainerBuilder;
2017-11-30 15:06:13 -05:00
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
2020-06-02 16:08:08 -04:00
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
2017-11-30 15:06:13 -05:00
2022-10-13 22:26:33 -04:00
class Kernel extends BaseKernel implements CompilerPassInterface
2017-11-30 15:06:13 -05:00
{
2022-03-03 10:53:48 -05:00
use MicroKernelTrait;
2020-06-02 16:08:08 -04:00
2022-03-03 10:53:48 -05:00
protected function configureContainer(ContainerConfigurator $container): void
{
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$container->import('../config/{services}.yaml');
$container->import('../config/{services}_' . $this->environment . '.yaml');
}
2020-06-02 16:08:08 -04:00
2022-03-03 10:53:48 -05:00
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->import('../config/{routes}/' . $this->environment . '/*.yaml');
$routes->import('../config/{routes}/*.yaml');
$routes->import('../config/{routes}.yaml');
}
2022-10-13 22:26:33 -04:00
public function process(ContainerBuilder $container)
{
$typesDefinition = [];
if ($container->hasParameter('doctrine.dbal.connection_factory.types')) {
$typesDefinition = $container->getParameter('doctrine.dbal.connection_factory.types');
}
$taggedEnums = $container->findTaggedServiceIds('app.doctrine_enum_type');
foreach ($taggedEnums as $enumType => $definition) {
$typesDefinition[$enumType::NAME] = ['class' => $enumType];
}
$container->setParameter('doctrine.dbal.connection_factory.types', $typesDefinition);
}
2017-11-30 15:06:13 -05:00
}