I was wondering whether there's a possible to modify a bundles configuration from another bundle. Let's say, for example, I'm using the FOSUserBundle with the following configuration:
fos_user:
db_driver: orm
firewall_name: main
user_class: Acme\UserBundle\Entity\User
And now, I want to change the user class when loading a specific extension (the AcmeFoobarExtension). Is it possible to change the configuration when loading
the AcmeFoobarExtension? For example:
<?php
namespace Acme\FoobarBundle\DependencyInjection;
// use statements for dependency injection
class FoobarExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$container->setConfiguration(
'fos_user.user_class',
'Acme\FoobarBundle\Entity\User'
);
}
}
Is something like this possible? Or defeats it the purpose of dependency injection?
EDIT: Apparently there's a pull request for Symfony 2.2 which addresses this idea/issue.
EDIT 2: This is now available in Symfony 2.2 (with an article in the cookbook).