Answer the question
In order to leave comments, you need to log in
How to get the value from the config inside the application?
Greetings! In the process of creating a bundle, a question arose.
There is a bundle configuration: some_package.yaml
some_package:
test:
value1: 11
value2: 22
Answer the question
In order to leave comments, you need to log in
As a temporary solution, I did this:
SomeBundleExtension.php
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yaml');
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('some_bundle.config', $config);
}
$config = $this->container->getParameter('some_bundle.config');
dd($config);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question