merged branch vicb/acl-lazy (PR #3568)
Commits
-------
c68c8b8
[SecurityBundle] Lazily load the post schema listener
Discussion
----------
[SecurityBundle] Lazily load the post schema listener
As suggested by @stof in #3560
This commit is contained in:
commit
23977b118f
@ -90,8 +90,7 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->arrayNode('acl')
|
||||
->children()
|
||||
->scalarNode('connection')
|
||||
->defaultValue('default')
|
||||
->cannotBeEmpty()
|
||||
->defaultNull()
|
||||
->setInfo('any name configured in doctrine.dbal section')
|
||||
->end()
|
||||
->arrayNode('cache')
|
||||
|
@ -133,13 +133,16 @@ class SecurityExtension extends Extension
|
||||
{
|
||||
$loader->load('security_acl_dbal.xml');
|
||||
|
||||
$container->setAlias('security.acl.dbal.connection', sprintf('doctrine.dbal.%s_connection', $config['connection']));
|
||||
if (null !== $config['connection']) {
|
||||
$container->setAlias('security.acl.dbal.connection', sprintf('doctrine.dbal.%s_connection', $config['connection']));
|
||||
}
|
||||
|
||||
$container
|
||||
->getDefinition('security.acl.dbal.schema_listener')
|
||||
->addTag('doctrine.event_listener', array(
|
||||
'connection' => $config['connection'],
|
||||
'event' => 'postGenerateSchema'
|
||||
'connection' => $config['connection'],
|
||||
'event' => 'postGenerateSchema',
|
||||
'lazy' => true
|
||||
))
|
||||
;
|
||||
|
||||
|
Reference in New Issue
Block a user