Skip to content

Commit a9e2d9e

Browse files
committed
Reflected SeoBundle config changes
1 parent ea20e56 commit a9e2d9e

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

DependencyInjection/CmfCoreExtension.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CmfCoreExtension extends Extension implements PrependExtensionInterface
3131
*/
3232
public function prepend(ContainerBuilder $container)
3333
{
34-
// process the configuration of SymfonyCmfCoreExtension
34+
// process the configuration of CmfCoreExtension
3535
$configs = $container->getExtensionConfig($this->getAlias());
3636
$parameterBag = $container->getParameterBag();
3737
$configs = $parameterBag->resolveValue($configs);
@@ -182,10 +182,9 @@ public function prepend(ContainerBuilder $container)
182182
'persistence' => array(
183183
'phpcr' => array(
184184
'enabled' => $persistenceConfig['enabled'],
185-
'use_sonata_admin' => $persistenceConfig['use_sonata_admin'],
186-
'content_basepath' => $persistenceConfig['basepath'].'/content',
187-
)
188-
)
185+
),
186+
),
187+
'sonata_admin_extension' => $persistenceConfig['use_sonata_admin'],
189188
);
190189
break;
191190
}
@@ -195,6 +194,31 @@ public function prepend(ContainerBuilder $container)
195194
}
196195
}
197196
}
197+
198+
if ($config['persistence']['orm']) {
199+
$bundles = $container->getParameter('kernel.bundles');
200+
$persistenceConfig = $config['persistence']['orm'];
201+
202+
foreach ($container->getExtensions() as $name => $extension) {
203+
$prependConfig = array();
204+
205+
switch ($name) {
206+
case 'cmf_seo':
207+
$prependConfig = array(
208+
'persistence' => array(
209+
'orm' => array(
210+
'enabled' => $persistenceConfig['enabled'],
211+
),
212+
),
213+
'sonata_admin_extension' => $persistenceConfig['use_sonata_admin'],
214+
);
215+
}
216+
217+
if ($prependConfig) {
218+
$container->prependExtensionConfig($name, $prependConfig);
219+
}
220+
}
221+
}
198222
}
199223

200224
/**

DependencyInjection/Configuration.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ public function getConfigTreeBuilder()
4343
->end()
4444
->scalarNode('translation_strategy')->defaultNull()->end()
4545
->end()
46+
->end() // phpcr
47+
->arrayNode('orm')
48+
->addDefaultsIfNotSet()
49+
->canBeEnabled()
50+
->children()
51+
->enumNode('use_sonata_admin')
52+
->values(array(true, false, 'auto'))
53+
->defaultValue('auto')
54+
->end()
55+
->end()
4656
->end()
4757
->end()
4858
->end()

0 commit comments

Comments
 (0)