Skip to content

Commit

Permalink
[console] Implement ConfigurationManager changes. (#3649)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas authored Jan 7, 2018
1 parent abc8313 commit 8f47242
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions bin/drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
chdir($drupalFinder->getDrupalRoot());
$configurationManager = new ConfigurationManager();
$configuration = $configurationManager
->loadConfigurationFromDirectory($drupalFinder->getComposerRoot());
->loadConfiguration($drupalFinder->getComposerRoot())
->getConfiguration();

$debug = $argvInputReader->get('debug', false);
if ($configuration && $options = $configuration->get('application.options') ?: []) {
Expand All @@ -74,7 +75,7 @@
);
}

$drupal = new Drupal($autoload, $drupalFinder);
$drupal = new Drupal($autoload, $drupalFinder, $configurationManager);
$container = $drupal->boot();

if (!$container) {
Expand Down
26 changes: 18 additions & 8 deletions src/Bootstrap/Drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Drupal\Console\Core\Bootstrap\DrupalConsoleCore;
use Drupal\Console\Core\Utils\DrupalFinder;
use Drupal\Console\Core\Bootstrap\DrupalInterface;
use Drupal\Console\Core\Utils\ConfigurationManager;

class Drupal implements DrupalInterface
{
Expand All @@ -23,16 +24,26 @@ class Drupal implements DrupalInterface
*/
protected $drupalFinder;

/**
* @var ConfigurationManager
*/
protected $configurationManager;

/**
* Drupal constructor.
*
* @param $autoload
* @param $drupalFinder
* @param $configurationManager
*/
public function __construct($autoload, DrupalFinder $drupalFinder)
{
public function __construct(
$autoload,
DrupalFinder $drupalFinder,
ConfigurationManager $configurationManager
) {
$this->autoload = $autoload;
$this->drupalFinder = $drupalFinder;
$this->configurationManager = $configurationManager;
}

/**
Expand Down Expand Up @@ -177,13 +188,12 @@ public function boot()

AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]);

// Load configuration from directory
$container->get('console.configuration_manager')
->loadConfiguration($this->drupalFinder->getComposerRoot())
->getConfiguration();
$container->set(
'console.configuration_manager',
$this->configurationManager
);

$configuration = $container->get('console.configuration_manager')
->getConfiguration();
$configuration = $this->configurationManager->getConfiguration();

$container->get('console.translator_manager')
->loadCoreLanguage(
Expand Down

0 comments on commit 8f47242

Please sign in to comment.