Answer the question
In order to leave comments, you need to log in
How to load Yaml configuration into the top level. Like how does the imports command do?
I want my bundle to overwrite the configuration of some third-party bundles when connecting
BundleExtension.php
public function load( array $config, ContainerBuilder $container ) {
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $config);
$container->setParameter("basebundle", $config);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
public function prepend( ContainerBuilder $container ) {
$configFile = __DIR__ . '/../Resources/config/views.yml';
$conf = Yaml::parse( file_get_contents( $configFile ) );
$container->prependExtensionConfig( 'basebundle', $conf );
$container->addResource( new FileResource( $configFile ) );
framework:
serializer:
enabled: true
enable_annotations: true
white_october_breadcrumbs:
separator: '%'
separatorClass: 'separator'
listId: 'wo-breadcrumbs'
listClass: 'breadcrumb'
Answer the question
In order to leave comments, you need to log in
class ixBaseExtension extends Extension implements PrependExtensionInterface
{
public function prepend( ContainerBuilder $container ) {
$container->prependExtensionConfig('assetic', ['bundles' => ['YourBundle']]);
}
}
public function load()
{
$bundles = $container->getParameter('kernel.bundles');
if (isset($bundles['FooBundle'])) {
$loader->load('replaceFooBundle.yml');
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question