1

Say I have an array like this in a custom array.yml in Bundle/Resources/config

array
   array
     value
     value
     value
array
   array
     value
     value
     value

Is there a quick and dirty way I can load it without having to use that cumbersome treebuilder?

1 Answer 1

2

Seems like the easiest way is to directly set the parameter in the container

class BundleExtension extends Extension
{

    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $loader->load('services.yml');

        $config = Yaml::parse(file_get_contents(__DIR__."/../Resources/config/array.yml"));
        $container->setParameter("bundle.array",$config);

    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.