Skip to content

[Bundles] [Bundle] Fix Bundle configuration/service key #19861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundles/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class, you can add all the logic related to processing the configuration in that
// use it directly to configure the service container (when defining an
// extension class, you also have to do this merging and processing)
$containerConfigurator->services()
->get('acme.social.twitter_client')
->get('acme_social.twitter_client')
->arg(0, $config['twitter']['client_id'])
->arg(1, $config['twitter']['client_secret'])
;
Expand Down Expand Up @@ -347,7 +347,7 @@ For example, imagine your bundle has the following example config:
https://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<service id="acme.social.twitter_client" class="Acme\SocialBundle\TwitterClient">
<service id="acme_social.twitter_client" class="Acme\SocialBundle\TwitterClient">
<argument></argument> <!-- will be filled in with client_id dynamically -->
<argument></argument> <!-- will be filled in with client_secret dynamically -->
</service>
Expand All @@ -370,7 +370,7 @@ In your extension, you can load this and dynamically set its arguments::
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$definition = $container->getDefinition('acme.social.twitter_client');
$definition = $container->getDefinition('acme_social.twitter_client');
$definition->replaceArgument(0, $config['twitter']['client_id']);
$definition->replaceArgument(1, $config['twitter']['client_secret']);
}
Expand Down
Loading