vendor/sonata-project/user-bundle/src/SonataUserBundle.php line 22

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of the Sonata Project package.
  5.  *
  6.  * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\UserBundle;
  12. use Sonata\CoreBundle\Form\FormHelper;
  13. use Sonata\UserBundle\DependencyInjection\Compiler\GlobalVariablesCompilerPass;
  14. use Sonata\UserBundle\DependencyInjection\Compiler\RolesMatrixCompilerPass;
  15. use Symfony\Component\DependencyInjection\ContainerBuilder;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. class SonataUserBundle extends Bundle
  18. {
  19.     public function build(ContainerBuilder $container): void
  20.     {
  21.         $container->addCompilerPass(new GlobalVariablesCompilerPass());
  22.         $container->addCompilerPass(new RolesMatrixCompilerPass());
  23.         $this->registerFormMapping();
  24.     }
  25.     public function boot(): void
  26.     {
  27.         $this->registerFormMapping();
  28.     }
  29.     /**
  30.      * Register form mapping information.
  31.      *
  32.      * NEXT_MAJOR: remove this method
  33.      */
  34.     public function registerFormMapping(): void
  35.     {
  36.         if (class_exists(FormHelper::class)) {
  37.             FormHelper::registerFormTypeMapping([
  38.                 'fos_user_username' => 'FOS\UserBundle\Form\Type\UsernameFormType',
  39.                 'fos_user_profile' => 'FOS\UserBundle\Form\Type\ProfileFormType',
  40.                 'fos_user_registration' => 'FOS\UserBundle\Form\Type\RegistrationFormType',
  41.                 'fos_user_change_password' => 'FOS\UserBundle\Form\Type\ChangePasswordFormType',
  42.                 'fos_user_resetting' => 'FOS\UserBundle\Form\Type\ResettingFormType',
  43.                 'fos_user_group' => 'FOS\UserBundle\Form\Type\GroupFormType',
  44.                 'sonata_security_roles' => 'Sonata\UserBundle\Form\Type\SecurityRolesType',
  45.                 'sonata_user_profile' => 'Sonata\UserBundle\Form\Type\ProfileType',
  46.                 'sonata_user_gender' => 'Sonata\UserBundle\Form\Type\UserGenderListType',
  47.                 'sonata_user_registration' => 'Sonata\UserBundle\Form\Type\RegistrationFormType',
  48.                 'sonata_user_api_form_group' => 'Sonata\UserBundle\Form\Type\ApiGroupType',
  49.                 'sonata_user_api_form_user' => 'Sonata\UserBundle\Form\Type\ApiUserType',
  50.             ]);
  51.         }
  52.     }
  53. }