Skip to content

Commit d9e7f22

Browse files
committed
feature #5621 Explain sample configuration parameter usage (bennyt2)
This PR was merged into the 2.7 branch. Discussion ---------- Explain sample configuration parameter usage The "Processing the `$configs` Array" section explains how to define parameters within the Configuration class and process them in the Extension. In my opinion, it doesn't take the example to a logical conclusion. People reading this file want to learn how to create configuration within a Bundle. It would be helpful to explain how the configuration can be used. Since the example uses parameters, I propose showing how the parameters can be loaded into the container. With these code changes, the `twitter.client_id` and `twitter.client_secret` are now available through use throughout the application. Commits ------- ceacc7c Explain sample configuration parameter usage
2 parents 524c045 + ceacc7c commit d9e7f22

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bundles/configuration.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,12 @@ thrown)::
223223
$configuration = new Configuration();
224224

225225
$config = $this->processConfiguration($configuration, $configs);
226-
// ...
226+
227+
// Example configuration parameter usage: Set configuration variables as
228+
// parameters in the container.
229+
$container->setParameter('twitter.client_id', $config['twitter']['client_id']);
230+
$container->setParameter('twitter.client_secret', $config['twitter']['client_secret']);
231+
227232
}
228233

229234
The ``processConfiguration()`` method uses the configuration tree you've defined

0 commit comments

Comments
 (0)