Skip to content

Commit

Permalink
bug #22669 [FrameworkBundle] AbstractConfigCommand: do not try regist…
Browse files Browse the repository at this point in the history
…ering bundles twice (ogizanagi)

This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/recipes#46
| License       | MIT
| Doc PR        | N/A

As spotted in symfony/recipes#46, there is no reason to call `registerBundles` on the kernel instance, as it's already booted. So we just have to use `getBundles` instead and `registerBundles` can be implemented in a non-rewindable way, as done with flex.

Commits
-------

040edfe [FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
  • Loading branch information
fabpot committed May 11, 2017
2 parents 2f1c28b + 040edfe commit 0ad2f2e
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -95,7 +95,7 @@ private function initializeBundles()
// Re-build bundle manually to initialize DI extensions that can be extended by other bundles in their build() method
// as this method is not called when the container is loaded from the cache.
$container = $this->getContainerBuilder();
$bundles = $this->getContainer()->get('kernel')->registerBundles();
$bundles = $this->getContainer()->get('kernel')->getBundles();
foreach ($bundles as $bundle) {
if ($extension = $bundle->getContainerExtension()) {
$container->registerExtension($extension);
Expand Down

0 comments on commit 0ad2f2e

Please sign in to comment.