use reflection to get the list of commands for tab-completion
This commit is contained in:
@@ -21,6 +21,7 @@ class OccController extends Controller
|
|||||||
private $userId;
|
private $userId;
|
||||||
|
|
||||||
private $application;
|
private $application;
|
||||||
|
private $symphonyApplication;
|
||||||
private $output;
|
private $output;
|
||||||
|
|
||||||
public function __construct(ILogger $logger, $AppName, IRequest $request, $userId)
|
public function __construct(ILogger $logger, $AppName, IRequest $request, $userId)
|
||||||
@@ -39,6 +40,9 @@ class OccController extends Controller
|
|||||||
$this->application->setAutoExit(false);
|
$this->application->setAutoExit(false);
|
||||||
$this->output = new OccOutput(OutputInterface::VERBOSITY_NORMAL, true);
|
$this->output = new OccOutput(OutputInterface::VERBOSITY_NORMAL, true);
|
||||||
$this->application->loadCommands(new StringInput(""), $this->output);
|
$this->application->loadCommands(new StringInput(""), $this->output);
|
||||||
|
$reflectionProperty = new \ReflectionProperty(Application::class, 'application');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$this->symphonyApplication = $reflectionProperty->getValue($this->application);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,11 +82,11 @@ class OccController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function list() {
|
public function list() {
|
||||||
// $defs = $this->application->application->all();
|
$defs = $this->symphonyApplication->all();
|
||||||
$cmds = array();
|
$cmds = array();
|
||||||
// foreach ($defs as $d) {
|
foreach ($defs as $d) {
|
||||||
// array_push($cmds, $d->getName());
|
array_push($cmds, $d->getName());
|
||||||
// }
|
}
|
||||||
return new DataResponse($cmds);
|
return new DataResponse($cmds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user