Added build and class cache to kernel
This commit is contained in:
parent
0e92e0a7ba
commit
62e80fc0af
@ -466,6 +466,17 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The extension point similar to the Bundle::build() method.
|
||||
*
|
||||
* Use this method to register compiler passes and manipulate the container during the building process.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
protected function build(ContainerBuilder $container)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the container class.
|
||||
*
|
||||
@ -625,10 +636,13 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
$container->addObjectResource($bundle);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->bundles as $bundle) {
|
||||
$bundle->build($container);
|
||||
}
|
||||
|
||||
$this->build($container);
|
||||
|
||||
// ensure these extensions are implicitly loaded
|
||||
$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions));
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class KernelWithoutBundles extends Kernel
|
||||
{
|
||||
public function registerBundles()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
}
|
||||
|
||||
protected function build(ContainerBuilder $container)
|
||||
{
|
||||
$container->setParameter('test_executed', true);
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles;
|
||||
|
||||
class KernelTest extends TestCase
|
||||
{
|
||||
@ -725,6 +726,14 @@ EOF;
|
||||
$kernel->terminate(Request::create('/'), new Response());
|
||||
}
|
||||
|
||||
public function testKernelWithoutBundles()
|
||||
{
|
||||
$kernel = new KernelWithoutBundles('test', true);
|
||||
$kernel->boot();
|
||||
|
||||
$this->assertTrue($kernel->getContainer()->getParameter('test_executed'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock for the BundleInterface.
|
||||
*
|
||||
|
Reference in New Issue
Block a user