symfony-bundle-dependencies icon indicating copy to clipboard operation
symfony-bundle-dependencies copied to clipboard

How to deal with config dependencies

Open wambaloo opened this issue 7 years ago • 0 comments

Hi !

Thank you for this library but I have a question for you : I try to develop for my company a bundle for SAML authentication. There is already a bundle that exists for that : HslavichOneloginSamlBundle. So my bundle is dependent to HslavichOneloginSamlBundle.

I want to put default configuration for this bundle inside my custom bundle, because all of my applications will have the same configuration for this login. But I cannot do that because Symfony send me error messages like

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: There is no extension able to load the configuration for "hslavich_onelogin_saml"

In my bundle extension file, I have the following code :

   /**
     * {@inheritdoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config        = $this->processConfiguration($configuration, $configs);
        
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('config.yml');
        $loader->load('services.yml');
        $loader->load('security.yml');
        
        $container->setParameter('my_custom_bundle.settings', $config);
    }

Is it possible to deal with dependency configuration or is it to specific to be accomplished with your plugin ?

Thanks in advance.

wambaloo avatar Oct 11 '17 12:10 wambaloo