Skip to content

Commit

Permalink
[DependencyInjection] added the possibility to pass the type of compi…
Browse files Browse the repository at this point in the history
…ler pass in ContainerBuilder::addCompilerPAss
  • Loading branch information
fabpot committed Jan 16, 2011
1 parent d5c9f37 commit 612dce8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/Symfony/Bundle/DoctrineBundle/DoctrineBundle.php
Expand Up @@ -29,8 +29,7 @@ public function registerExtensions(ContainerBuilder $container)
{
parent::registerExtensions($container);

$passConfig = $container->getCompilerPassConfig();
$passConfig->addPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
$passConfig->addPass(new CreateProxyDirectoryPass(), PassConfig::TYPE_BEFORE_REMOVING);
$container->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
$container->addCompilerPass(new CreateProxyDirectoryPass(), PassConfig::TYPE_BEFORE_REMOVING);
}
}
Expand Up @@ -3,6 +3,7 @@
namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;

/**
* This class is used to remove circular dependencies between individual passes.
Expand Down Expand Up @@ -34,9 +35,9 @@ public function getServiceReferenceGraph()
return $this->serviceReferenceGraph;
}

public function addPass(CompilerPassInterface $pass)
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
{
$this->passConfig->addPass($pass);
$this->passConfig->addPass($pass, $type);
}

public function addLogMessage($string)
Expand Down
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\DependencyInjection\Compiler\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\InterfaceInjector;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
Expand Down Expand Up @@ -148,11 +149,11 @@ public function loadFromExtension($extension, $tag, array $values = array())
* Adds a compiler pass at the end of the current passes
*
* @param CompilerPassInterface $pass
* @return void
* @param string $type
*/
public function addCompilerPass(CompilerPassInterface $pass)
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
{
$this->compiler->addPass($pass);
$this->compiler->addPass($pass, $type);

$this->addObjectResource($pass);
}
Expand Down

0 comments on commit 612dce8

Please sign in to comment.