Skip to content

Commit ea920a9

Browse files
authored
[composerize] Replace console.root service with drupal_finder service. (#3796)
1 parent 7df301b commit ea920a9

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/Command/ComposerizeCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$includeVersion = $input->getOption('include-version');
7878
$showPackages = $input->getOption('show-packages')?:false;
7979

80-
$this->drupalFinder = new DrupalFinder();
81-
$this->drupalFinder->locateRoot(getcwd());
80+
$this->drupalFinder = $this->get('console.drupal_finder');
8281

8382
$this->extensionManager = $this->get('console.extension_manager');
8483
$this->extractCorePackages();
@@ -122,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
122121
}
123122
}
124123
$this->getIo()->comment($this->trans('commands.composerize.messages.from'));
125-
$this->getIo()->simple($this->get('console.root'));
124+
$this->getIo()->simple($this->drupalFinder->getComposerRoot());
126125
$this->getIo()->newLine();
127126
$this->getIo()->comment($this->trans('commands.composerize.messages.execute'));
128127
$this->getIo()->simple($composerCommand);

src/Utils/TranslatorManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ private function addResourceTranslationsByTheme($theme)
8080
*/
8181
private function addResourceTranslationsByLibrary($library)
8282
{
83-
$path = \Drupal::service('console.root') . '/vendor/' . $library;
83+
/** @var \Drupal\Console\Core\Utils\DrupalFinder $drupalFinder */
84+
$drupalFinder = \Drupal::service('console.drupal_finder');
85+
$path = $drupalFinder->getComposerRoot() . '/vendor/' . $library;
8486
$this->addResourceTranslationsByExtensionPath(
8587
$path
8688
);

0 commit comments

Comments
 (0)