Skip to content

Commit

Permalink
Use $dependencies instead of getting logger manually
Browse files Browse the repository at this point in the history
  • Loading branch information
bergice committed Apr 10, 2019
1 parent 1809691 commit f234a8d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/FileMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,20 @@ class FileMigrationHelper
*/
private static $delete_invalid_files = true;

private static $dependencies = [
'logger' => '%$' . LoggerInterface::class,
];

/** @var LoggerInterface */
private $logger;

/**
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger) {
$this->logger = $logger;
}

/**
* Perform migration
*
Expand All @@ -61,8 +72,6 @@ public function run($base = null)
Environment::increaseTimeLimitTo();
Environment::increaseMemoryLimitTo();

$this->logger = Injector::inst()->get(LoggerInterface::class);

// Loop over all files
$processedCount = $migratedCount = 0;
$originalState = null;
Expand Down

0 comments on commit f234a8d

Please sign in to comment.