minor #17495 [2.7] [FrameworkBundle] [DX] Sort bundles in config commands (kix)
This PR was merged into the 2.7 branch.
Discussion
----------
[2.7] [FrameworkBundle] [DX] Sort bundles in config commands
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | none
Reopened against `2.7` instead of #17490
This makes the behaviour of config commands a bit more user-friendly. Scanning through an ordered list should be a lot easier for the user, especially if she knows what's the exact bundle they're looking for. The sort is applied to the bundle name, as the extension alias might not always be present.
Before:
![before](https://cloud.githubusercontent.com/assets/345754/12498061/8e0ff30a-c0c1-11e5-9c96-561065eedc79.png)
After:
![after](https://cloud.githubusercontent.com/assets/345754/12498064/93019bde-c0c1-11e5-8bbc-c85a74b3f5e8.png)
Commits
-------
80d51e0
Sort bundles in config commands
This commit is contained in:
commit
870b40cf59
@ -30,7 +30,13 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
|||||||
{
|
{
|
||||||
$headers = array('Bundle name', 'Extension alias');
|
$headers = array('Bundle name', 'Extension alias');
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
|
||||||
|
$bundles = $this->getContainer()->get('kernel')->getBundles();
|
||||||
|
usort($bundles, function($bundleA, $bundleB) {
|
||||||
|
return strcmp($bundleA->getName(), $bundleB->getName());
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach ($bundles as $bundle) {
|
||||||
$extension = $bundle->getContainerExtension();
|
$extension = $bundle->getContainerExtension();
|
||||||
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
|
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user