Created
December 28, 2021 22:52
-
-
Save ismail1432/f2fd80c0290773d2bb12a4c8e7a23a6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App; | |
| use App\DoctrineType\AbstractEnumType; | |
| use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | |
| use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
| use Symfony\Component\DependencyInjection\ContainerBuilder; | |
| use Symfony\Component\HttpKernel\Kernel as BaseKernel; | |
| class Kernel extends BaseKernel implements CompilerPassInterface | |
| { | |
| use MicroKernelTrait; | |
| public function process(ContainerBuilder $container): void | |
| { | |
| $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) { | |
| /** @var $enumType AbstractEnumType */ | |
| $typesDefinition[$enumType::NAME] = ['class' => $enumType]; | |
| } | |
| $container->setParameter('doctrine.dbal.connection_factory.types', $typesDefinition); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment