1 | <?php |
||
21 | class FSiAdminSecurityBundle extends Bundle |
||
22 | { |
||
23 | public function build(ContainerBuilder $container) |
||
24 | { |
||
25 | parent::build($container); |
||
26 | |||
27 | $container->addCompilerPass(new FirewallMapCompilerPass()); |
||
28 | $container->addCompilerPass(new ValidationCompilerPass()); |
||
29 | |||
30 | $doctrineConfigDir = realpath(__DIR__ . '/Resources/config/doctrine'); |
||
31 | |||
32 | $mappings = [ |
||
33 | $doctrineConfigDir . '/User' => 'FSi\Bundle\AdminSecurityBundle\Security\User', |
||
34 | $doctrineConfigDir . '/Token' => 'FSi\Bundle\AdminSecurityBundle\Security\Token', |
||
35 | ]; |
||
36 | |||
37 | $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings)); |
||
38 | |||
39 | if ($container->hasExtension('fos_user')) { |
||
40 | $mappings = [ |
||
41 | $doctrineConfigDir . '/FOS' => 'FSi\Bundle\AdminSecurityBundle\Security\FOS', |
||
42 | ]; |
||
43 | |||
44 | $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings)); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | public function boot() |
||
49 | { |
||
50 | $userRepository = $this->container->get('admin_security.repository.user'); |
||
51 | if (!($userRepository instanceof UserRepositoryInterface)) { |
||
52 | throw new LogicException(sprintf( |
||
53 | 'Repository for class "\%s" does not implement the "\%s" interface!', |
||
54 | get_class($userRepository), |
||
55 | 'FSi\Bundle\AdminSecurityBundle\Security\User\UserRepositoryInterface' |
||
56 | )); |
||
57 | } |
||
58 | |||
59 | parent::boot(); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return FSIAdminSecurityExtension |
||
64 | */ |
||
65 | public function getContainerExtension() |
||
73 | } |
||
74 |