[HttpKernel] made the Kernel class more flexible (closes #7396)
This commit is contained in:
parent
84ff273986
commit
757194c775
@ -636,6 +636,26 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$container = $this->getContainerBuilder();
|
$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();
|
$extensions = array();
|
||||||
foreach ($this->bundles as $bundle) {
|
foreach ($this->bundles as $bundle) {
|
||||||
if ($extension = $bundle->getContainerExtension()) {
|
if ($extension = $bundle->getContainerExtension()) {
|
||||||
@ -651,19 +671,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
$bundle->build($container);
|
$bundle->build($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
$container->addObjectResource($this);
|
|
||||||
|
|
||||||
// ensure these extensions are implicitly loaded
|
// ensure these extensions are implicitly loaded
|
||||||
$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions));
|
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user