Skip to content

comsave/dependency-injection-config-to-parameters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dependancy-injection-config-to-parameters

Injects Symfony configs as parameters into the container.

How to use?

Define your DI extension like this.

namespace YourCompany\YourBundle\DependencyInjection;

class YourBundleExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();

        Comsave\Tools\DependencyInjectionConfigsToParams::setupConfigurationParameters(
            $container,
            $this->processConfiguration($configuration, $configs),
            'your_configuration_namespace'
        );

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');
    }
}

Tests

todo

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages