Symfony 2: How to dynamically adjust configuration parameters <p>For my <code>AppBundle</code> (THE APPLICATION ITSELF, NOT A REUSABLE BUNDLE) I have a configuration parameter that is a path. I'd like to be sure the path ends with a <code>/</code>.</p> <p>In this moment I have a method in the entity that uses this path (yes is an entity and not a controller) adjust the configuration parameter with a code like this:</p> <pre><code>public function buildLogoFolder($folder) { // Replace the placeholder with the current Entity's URL $folder = str_replace('{entity_domain}', $this-&gt;getDomain()-&gt;getCanonical(), $folder); $folder = rtrim(ltrim($folder, '/'), '/') . '/'; return $folder; } </code></pre> <p>As the <code>$folder</code> parameter comes from the <code>config.yml</code> file I'd like to move outside of the entity this adjustment.</p> <p>I think I should use a solution similar to the one suggested <a href="http://stackoverflow.com/questions/14651871/how-to-dynamically-append-sections-to-symfony-2-configuration">here</a>, that is the use of the <code>DependencyInjection</code> component.</p> <p>I think the process is very similar to the <a href="http://symfony.com/doc/current/cookbook/bundles/extension.html" rel="nofollow">loading of</a> a <a href="http://symfony.com/doc/current/cookbook/bundles/configuration.html" rel="nofollow">configuration file</a> for a new bundle as explained in the Symfony's documentation but I'm not sure on how to proceed.</p> <p>Is there someone who can put me on the right way?</p> <p><strong>I'd like to automate the process. I want read the <code>folder</code> configuration parameter value and then adjust it with the method I wrote above.</strong></p> <p><strong>I want to be sure that the <code>folder</code> parameter configured ever ends with a trailing slash, also if the developer didn't write it in the configuration.</strong></p> <p><strong>So, If the developer write something like <code>path/to/folder</code> the resulting configuration parameter is automatically adjusted to <code>path/to/folder/</code></strong>.</p>