File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the FOSUserBundle package.
5+ *
6+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace FOS \UserBundle \DependencyInjection \Compiler ;
13+
14+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
15+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
16+ use Symfony \Component \DependencyInjection \Reference ;
17+
18+ /**
19+ * Injects firewall's UserChecker into LoginManager.
20+ *
21+ * @author Gocha Ossinkine <ossinkine@ya.ru>
22+ */
23+ class InjectUserCheckerPass implements CompilerPassInterface
24+ {
25+ /**
26+ * {@inheritdoc}
27+ */
28+ public function process (ContainerBuilder $ container )
29+ {
30+ $ firewallName = $ container ->getParameter ('fos_user.firewall_name ' );
31+ $ loginManager = $ container ->getDefinition ('fos_user.security.login_manager ' );
32+
33+ if ($ container ->hasAlias ('security.user_checker. ' .$ firewallName )) {
34+ $ loginManager ->replaceArgument (1 , new Reference ('security.user_checker. ' .$ firewallName ));
35+ }
36+ }
37+ }
Original file line number Diff line number Diff line change 1515use Doctrine \Bundle \DoctrineBundle \DependencyInjection \Compiler \DoctrineOrmMappingsPass ;
1616use Doctrine \Bundle \MongoDBBundle \DependencyInjection \Compiler \DoctrineMongoDBMappingsPass ;
1717use FOS \UserBundle \DependencyInjection \Compiler \InjectRememberMeServicesPass ;
18+ use FOS \UserBundle \DependencyInjection \Compiler \InjectUserCheckerPass ;
1819use FOS \UserBundle \DependencyInjection \Compiler \ValidationPass ;
1920use Symfony \Component \DependencyInjection \ContainerBuilder ;
2021use Symfony \Component \HttpKernel \Bundle \Bundle ;
@@ -32,6 +33,7 @@ public function build(ContainerBuilder $container)
3233 {
3334 parent ::build ($ container );
3435 $ container ->addCompilerPass (new ValidationPass ());
36+ $ container ->addCompilerPass (new InjectUserCheckerPass ());
3537 $ container ->addCompilerPass (new InjectRememberMeServicesPass ());
3638
3739 $ this ->addRegisterMappingsPass ($ container );
You can’t perform that action at this time.
0 commit comments