vendor/nucleos/user-bundle/src/NucleosUserBundle.php line 23

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of the NucleosUserBundle package.
  5.  *
  6.  * (c) Christian Gripp <[email protected]>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Nucleos\UserBundle;
  12. use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
  13. use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
  14. use Nucleos\UserBundle\DependencyInjection\Compiler\InjectRememberMeServicesPass;
  15. use Nucleos\UserBundle\DependencyInjection\Compiler\InjectUserCheckerPass;
  16. use Symfony\Component\DependencyInjection\ContainerBuilder;
  17. use Symfony\Component\HttpKernel\Bundle\Bundle;
  18. final class NucleosUserBundle extends Bundle
  19. {
  20.     public function build(ContainerBuilder $container): void
  21.     {
  22.         parent::build($container);
  23.         $container->addCompilerPass(new InjectUserCheckerPass());
  24.         $container->addCompilerPass(new InjectRememberMeServicesPass());
  25.         $this->addRegisterMappingsPass($container);
  26.     }
  27.     private function addRegisterMappingsPass(ContainerBuilder $container): void
  28.     {
  29.         $mappings = [
  30.             (string) realpath(__DIR__.'/Resources/config/doctrine-mapping') => 'Nucleos\UserBundle\Model',
  31.         ];
  32.         if (class_exists(DoctrineOrmMappingsPass::class)) {
  33.             $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, ['nucleos_user.model_manager_name'], 'nucleos_user.backend_type_orm'));
  34.         }
  35.         if (class_exists(DoctrineMongoDBMappingsPass::class)) {
  36.             $container->addCompilerPass(DoctrineMongoDBMappingsPass::createXmlMappingDriver($mappings, ['nucleos_user.model_manager_name'], 'nucleos_user.backend_type_mongodb'));
  37.         }
  38.     }
  39. }