Maybe you can create Compiler Pass, execute it from Bundle class (for
example HelloBundle.php) like that:

public function registerExtensions(ContainerBuilder $container)
{
    parent::registerExtensions($container);
    $container->addCompilerPass(new addModulesPass());
}

then you define /DependencyInjection/Compiler/addModulesPass.php class

<?php
namespace Application\HelloBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler
\CompilerPassInterface;

class addModulesPass implements CompilerPassInterface
{
  public function process(ContainerBuilder $container)
  {
    if ($container->hasDefinition('module_manager') && $container-
>hasDefinition('module_user'))
    {
      $container->getDefinition('module_manager')-
>addMethodCall('addModule', array(new Reference('module_user')));
    }
  }
}

I am just starting to experiment with Compiler Pass tho
A lot of examples can be found in core libs
Here in this topic I get advice to use Compiler Pass to solve my
problem:
http://groups.google.com/group/symfony-devs/browse_thread/thread/e031e678a4a5eaef#

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to