Skip to content

Commit

Permalink
[HttpKernel] made the Kernel class more flexible (closes #7396)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 20, 2013
1 parent 84ff273 commit 757194c
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/Symfony/Component/HttpKernel/Kernel.php
Expand Up @@ -636,6 +636,26 @@ protected function buildContainer()
}

$container = $this->getContainerBuilder();
$container->addObjectResource($this);
$this->prepareContainer($container);

if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
$container->merge($cont);
}

$container->addCompilerPass(new AddClassesToCachePass($this));
$container->compile();

return $container;
}

/**
* Prepares the ContainerBuilder before it is compiled.
*
* @param ContainerBuilder $container A ContainerBuilder instance
*/
protected function prepareContainer(ContainerBuilder $container)
{
$extensions = array();
foreach ($this->bundles as $bundle) {
if ($extension = $bundle->getContainerExtension()) {
Expand All @@ -651,19 +671,8 @@ protected function buildContainer()
$bundle->build($container);
}

$container->addObjectResource($this);

// ensure these extensions are implicitly loaded
$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions));

if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
$container->merge($cont);
}

$container->addCompilerPass(new AddClassesToCachePass($this));
$container->compile();

return $container;
}

/**
Expand Down

0 comments on commit 757194c

Please sign in to comment.