You can use your Bundle Extension class in DependancyInjection folder for that. There is a option to add custom configuration to another bundles configuration (http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html). My code that does the same is below.
<?php
namespace Zveen\CmsBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ZveenCmsExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('zveen.cmsbundle.tenant.class', $config['tenant']['class']);
$container->setParameter('zveen.cmsbundle.tenant.dql', $config['tenant']['class']);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
/**
* Allow an extension to prepend the extension configurations.
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
// get all Bundles
$bundles = $container->getParameter('kernel.bundles');
if (isset($bundles['DoctrineBundle'])) {
// Get configuration of our own bundle
$configs = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration(new Configuration(), $configs);
// Prepare for insertion
$forInsertion = array(
'orm' => array(
'resolve_target_entities' => array(
'Zveen\CmsBundle\Entity\TenantInterface' => $config['tenant']['class']
)
)
);
foreach ($container->getExtensions() as $name => $extension) {
switch ($name) {
case 'doctrine':
$container->prependExtensionConfig($name, $forInsertion);
break;
}
}
}
}
}