vendor/friendsofsymfony/user-bundle/FOSUserBundle.php line 32

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSUserBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace FOS\UserBundle;
  11. use Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass;
  12. use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
  13. use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
  14. use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass;
  15. use FOS\UserBundle\DependencyInjection\Compiler\CheckForSwiftMailerPass;
  16. use FOS\UserBundle\DependencyInjection\Compiler\ConfigurePasswordHasherPass;
  17. use FOS\UserBundle\DependencyInjection\Compiler\InjectRememberMeServicesPass;
  18. use FOS\UserBundle\DependencyInjection\Compiler\InjectUserCheckerPass;
  19. use FOS\UserBundle\DependencyInjection\Compiler\ValidationPass;
  20. use Symfony\Component\DependencyInjection\ContainerBuilder;
  21. use Symfony\Component\HttpKernel\Bundle\Bundle;
  22. /**
  23.  * @author Matthieu Bontemps <[email protected]>
  24.  * @author Thibault Duplessis <[email protected]>
  25.  *
  26.  * @final
  27.  */
  28. class FOSUserBundle extends Bundle
  29. {
  30.     public function build(ContainerBuilder $container)
  31.     {
  32.         parent::build($container);
  33.         $container->addCompilerPass(new ConfigurePasswordHasherPass());
  34.         $container->addCompilerPass(new ValidationPass());
  35.         $container->addCompilerPass(new InjectUserCheckerPass());
  36.         $container->addCompilerPass(new InjectRememberMeServicesPass());
  37.         $container->addCompilerPass(new CheckForSessionPass());
  38.         $container->addCompilerPass(new CheckForSwiftMailerPass());
  39.         $this->addRegisterMappingsPass($container);
  40.     }
  41.     private function addRegisterMappingsPass(ContainerBuilder $container)
  42.     {
  43.         $mappings = [
  44.             realpath(__DIR__.'/Resources/config/doctrine-mapping') => 'FOS\UserBundle\Model',
  45.         ];
  46.         if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) {
  47.             $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_orm'));
  48.         }
  49.         if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) {
  50.             $container->addCompilerPass(DoctrineMongoDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_mongodb'));
  51.         }
  52.         if (class_exists('Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass')) {
  53.             $container->addCompilerPass(DoctrineCouchDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_couchdb'));
  54.         }
  55.     }
  56. }