Skip to content

Commit

Permalink
Initialise Database Helper from Object Manager if not passed by DI.
Browse files Browse the repository at this point in the history
Increases backwards compatability.
  • Loading branch information
Graham Wharton committed Apr 29, 2019
1 parent 76e74ca commit f33b038
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/code/Magento/Theme/Model/Design/Backend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class File extends BackendFile
* @param RequestDataInterface $requestData
* @param Filesystem $filesystem
* @param UrlInterface $urlBuilder
* @param Database $databaseHelper
* @param AbstractResource|null $resource
* @param AbstractDb|null $resourceCollection
* @param array $data
* @param Database $databaseHelper
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Expand All @@ -69,10 +69,10 @@ public function __construct(
RequestDataInterface $requestData,
Filesystem $filesystem,
UrlInterface $urlBuilder,
Database $databaseHelper,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
array $data = []
array $data = [],
Database $databaseHelper = null
) {
parent::__construct(
$context,
Expand All @@ -87,7 +87,7 @@ public function __construct(
$data
);
$this->urlBuilder = $urlBuilder;
$this->databaseHelper = $databaseHelper;
$this->databaseHelper = $databaseHelper ?: ObjectManager::getInstance()->get(Database::class);
}

/**
Expand Down

0 comments on commit f33b038

Please sign in to comment.