Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e4bc20

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Fix code example about prepend config
2 parents7cfe1de +bd0ad98 commit2e4bc20

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

‎bundles/prepend_extension.rst‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,18 @@ in case a specific other bundle is not registered::
8080
}
8181
}
8282

83-
//process the configuration of AcmeHelloExtension
83+
//get the configuration of AcmeHelloExtension (it's a list of configuration)
8484
$configs = $container->getExtensionConfig($this->getAlias());
8585

86-
// resolve config parameters e.g. %kernel.debug% to its boolean value
87-
$resolvingBag = $container->getParameterBag();
88-
$configs = $resolvingBag->resolveValue($configs);
89-
90-
// use the Configuration class to generate a config array with
91-
// the settings "acme_hello"
92-
$config = $this->processConfiguration(new Configuration(), $configs);
93-
94-
// check if entity_manager_name is set in the "acme_hello" configuration
95-
if (isset($config['entity_manager_name'])) {
96-
// prepend the acme_something settings with the entity_manager_name
97-
$config = ['entity_manager_name' => $config['entity_manager_name']];
98-
$container->prependExtensionConfig('acme_something', $config);
86+
// iterate in reverse to preserve the original order after prepending the config
87+
foreach (array_reverse($configs) as $config) {
88+
// check if entity_manager_name is set in the "acme_hello" configuration
89+
if (isset($config['entity_manager_name'])) {
90+
// prepend the acme_something settings with the entity_manager_name
91+
$container->prependExtensionConfig('acme_something', [
92+
'entity_manager_name' => $config['entity_manager_name'],
93+
]);
94+
}
9995
}
10096
}
10197

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp