Command: allow to override dbResourceName

fixes #1410
This commit is contained in:
Thomas Gelf 2018-02-25 18:03:46 +01:00
parent 22eb5911f0
commit 64e1f463a2
1 changed files with 7 additions and 3 deletions

View File

@ -99,9 +99,13 @@ class Command extends CliCommand
protected function db()
{
if ($this->db === null) {
// Hint: not using $this->Config() intentionally. This allows
// CLI commands in other modules to use this as a base class.
$resourceName = Config::module('director')->get('db', 'resource');
$resourceName = $this->params->get('dbResourceName');
if ($resourceName === null) {
// Hint: not using $this->Config() intentionally. This allows
// CLI commands in other modules to use this as a base class.
$resourceName = Config::module('director')->get('db', 'resource');
}
if ($resourceName) {
$this->db = Db::fromResourceName($resourceName);
} else {