Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92e419d

Browse files
committed
Adding back ContainerBuilderAwareLoader::getResourceLoader()
This allows us to pass configureServices() the original, unwrapper loader, which could be useful if you've chosen to use a different LoaderInterface concrete implementation with custom methods. You should have access to this.
1 parent 11a6021 commit 92e419d

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Kernel/ContainerBuilderAwareLoader.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public function getContainerBuilder()
4949
return $this->containerBuilder;
5050
}
5151

52+
/**
53+
* @return LoaderInterface
54+
*/
55+
public function getResourceLoader()
56+
{
57+
return $this->resourceLoader;
58+
}
59+
5260
/**
5361
* @see {@inheritdoc}
5462
*/

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernel.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public function registerContainerConfiguration(LoaderInterface $loader)
9999

100100
/* @var ContainerBuilderAwareLoader $loader */
101101
$builder = $loader->getContainerBuilder();
102-
$loader = $loader->getResourceLoader();
103102

104103
// load the bundle configuration
105104
foreach ($this->bundleConfiguration as $bundleName => $configuration) {
@@ -115,7 +114,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
115114
// allow the kernel to configure its services
116115
$this->configureServices(
117116
$builder,
118-
$loader
117+
$loader->getResourceLoader()
119118
);
120119
}
121120

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Kernel/MicroKernelForTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class MicroKernelForTest extends MicroKernel
2323

2424
private $configureServicesCalled = false;
2525

26+
private $configureServicesArgs = array();
27+
2628
public function addBundleExternally(BundleInterface $bundle, $configuration = array())
2729
{
2830
$this->addBundle($bundle, $configuration);
@@ -45,6 +47,8 @@ protected function configureBundles()
4547

4648
protected function configureServices(ContainerBuilder $c, LoaderInterface $loader)
4749
{
50+
$this->configureServicesArgs = array($c, $loader);
51+
4852
$this->configureServicesCalled = true;
4953
}
5054

@@ -57,4 +61,9 @@ public function wasConfigureServicesCalled()
5761
{
5862
return $this->configureServicesCalled;
5963
}
64+
65+
public function getConfigureServicesArguments()
66+
{
67+
return $this->configureServicesArgs;
68+
}
6069
}

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public function testRegisterContainerConfiguration()
8787
$kernel->registerContainerConfiguration($loader);
8888

8989
$this->assertTrue($kernel->wasConfigureServicesCalled());
90+
$configureServicesArgs = $kernel->getConfigureServicesArguments();
91+
$this->assertSame($loader->getResourceLoader(), $configureServicesArgs[1], 'The original loader is sent to configureServices');
9092
}
9193

9294
/**

0 commit comments

Comments
 (0)