Is it possible to get config parameters during compiler pass? I have this extention config:
my_extension:
foo: 'bar'
I need to see if a config is set before adding a compiler pass:
<?php
namespace My\TestBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
class MyTestBundle extends Bundle
{
/**
* @param ContainerBuilder $container
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
// Here I need to check if 'foo' == 'bar' from the extension config and then add the following compiler pass
$container->addCompilerPass(
DoctrineOrmMappingsPass::createAnnotationMappingDriver(
[__NAMESPACE__],
[
__DIR__.'/Model',
]
)
);
}
}
The problem is that at the time of compiler pass, the extension config is not yet processed: or am I wrong?