56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
/*
|
|
* 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;
|
|
|
|
use App\Types\AbstractEnumType;
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
|
|
|
class Kernel extends BaseKernel implements CompilerPassInterface
|
|
{
|
|
use MicroKernelTrait;
|
|
|
|
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');
|
|
}
|
|
|
|
protected function configureRoutes(RoutingConfigurator $routes): void
|
|
{
|
|
$routes->import('../config/{routes}/' . $this->environment . '/*.yaml');
|
|
$routes->import('../config/{routes}/*.yaml');
|
|
$routes->import('../config/{routes}.yaml');
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|