Skip to content

Commit a806a18

Browse files
committed
bug #17569 [FrameworkBundle] read commands from bundles when accessing list (havvg)
This PR was merged into the 2.3 branch. Discussion ---------- [FrameworkBundle] read commands from bundles when accessing list | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This allows access to the list of commands registered by the kernel (bundle and later service ids) programmatically when you do not `run` the application. Commits ------- 0fe3088 register commands from kernel when accessing list
2 parents 712f2af + 34490f3 commit a806a18

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Application.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public function has($name)
436436
public function getNamespaces()
437437
{
438438
$namespaces = array();
439-
foreach ($this->commands as $command) {
439+
foreach ($this->all() as $command) {
440440
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
441441

442442
foreach ($command->getAliases() as $alias) {
@@ -530,7 +530,7 @@ public function find($name)
530530

531531
// name
532532
$commands = array();
533-
foreach ($this->commands as $command) {
533+
foreach ($this->all() as $command) {
534534
$extractedNamespace = $this->extractNamespace($command->getName());
535535
if ($extractedNamespace === $namespace
536536
|| !empty($namespace) && 0 === strpos($extractedNamespace, $namespace)
@@ -556,7 +556,7 @@ public function find($name)
556556

557557
// aliases
558558
$aliases = array();
559-
foreach ($this->commands as $command) {
559+
foreach ($this->all() as $command) {
560560
foreach ($command->getAliases() as $alias) {
561561
$extractedNamespace = $this->extractNamespace($alias);
562562
if ($extractedNamespace === $namespace
@@ -1028,7 +1028,7 @@ private function findAlternativeCommands($name, $abbrevs)
10281028
return $item->getName();
10291029
};
10301030

1031-
return $this->findAlternatives($name, $this->commands, $abbrevs, $callback);
1031+
return $this->findAlternatives($name, $this->all(), $abbrevs, $callback);
10321032
}
10331033

10341034
/**

0 commit comments

Comments
 (0)