File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -466,6 +466,17 @@ protected function initializeBundles()
466
466
}
467
467
}
468
468
469
+ /**
470
+ * The extension point similar to the Bundle::build() method.
471
+ *
472
+ * Use this method to register compiler passes and manipulate the container during the building process.
473
+ *
474
+ * @param ContainerBuilder $container
475
+ */
476
+ protected function build (ContainerBuilder $ container )
477
+ {
478
+ }
479
+
469
480
/**
470
481
* Gets the container class.
471
482
*
@@ -625,10 +636,13 @@ protected function prepareContainer(ContainerBuilder $container)
625
636
$ container ->addObjectResource ($ bundle );
626
637
}
627
638
}
639
+
628
640
foreach ($ this ->bundles as $ bundle ) {
629
641
$ bundle ->build ($ container );
630
642
}
631
643
644
+ $ this ->build ($ container );
645
+
632
646
// ensure these extensions are implicitly loaded
633
647
$ container ->getCompilerPassConfig ()->setMergePass (new MergeExtensionConfigurationPass ($ extensions ));
634
648
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Component \HttpKernel \Tests \Fixtures ;
13
+
14
+ use Symfony \Component \Config \Loader \LoaderInterface ;
15
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
+ use Symfony \Component \HttpKernel \Kernel ;
17
+
18
+ class KernelWithoutBundles extends Kernel
19
+ {
20
+ public function registerBundles ()
21
+ {
22
+ return array ();
23
+ }
24
+
25
+ public function registerContainerConfiguration (LoaderInterface $ loader )
26
+ {
27
+ }
28
+
29
+ protected function build (ContainerBuilder $ container )
30
+ {
31
+ $ container ->setParameter ('test_executed ' , true );
32
+ }
33
+ }
Original file line number Diff line number Diff line change 21
21
use Symfony \Component \HttpFoundation \Response ;
22
22
use Symfony \Component \HttpKernel \Tests \Fixtures \KernelForTest ;
23
23
use Symfony \Component \HttpKernel \Tests \Fixtures \KernelForOverrideName ;
24
+ use Symfony \Component \HttpKernel \Tests \Fixtures \KernelWithoutBundles ;
24
25
25
26
class KernelTest extends TestCase
26
27
{
@@ -725,6 +726,14 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
725
726
$ kernel ->terminate (Request::create ('/ ' ), new Response ());
726
727
}
727
728
729
+ public function testKernelWithoutBundles ()
730
+ {
731
+ $ kernel = new KernelWithoutBundles ('test ' , true );
732
+ $ kernel ->boot ();
733
+
734
+ $ this ->assertTrue ($ kernel ->getContainer ()->getParameter ('test_executed ' ));
735
+ }
736
+
728
737
/**
729
738
* Returns a mock for the BundleInterface.
730
739
*
You can’t perform that action at this time.
0 commit comments