-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-7248 Switch to connection parameter provider
- Loading branch information
1 parent
8537c33
commit 713b31d
Showing
8 changed files
with
115 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
source/Internal/Framework/Database/ConnectionParameterProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Database; | ||
|
||
use OxidEsales\EshopCommunity\Internal\Framework\Configuration\Dao\SystemConfigurationDaoInterface; | ||
|
||
class ConnectionParameterProvider implements ConnectionParameterProviderInterface | ||
{ | ||
public function __construct( | ||
private readonly SystemConfigurationDaoInterface $systemConfigurationDao, | ||
) { | ||
} | ||
|
||
public function getParameters(): array | ||
{ | ||
return ['url' => $this->systemConfigurationDao->get()->getDatabaseUrl()]; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
source/Internal/Framework/Database/ConnectionParameterProviderInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Database; | ||
|
||
interface ConnectionParameterProviderInterface | ||
{ | ||
public function getParameters(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Tests; | ||
|
||
use OxidEsales\EshopCommunity\Internal\Framework\Env\DotenvLoader; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\Filesystem\Path; | ||
|
||
trait EnvTrait | ||
{ | ||
private function loadEnvFixture(string $fixtureDir, array $envFileLines): void | ||
{ | ||
$filesystem = new Filesystem(); | ||
$fixtureFile = Path::join($fixtureDir, '.env'); | ||
$filesystem->dumpFile($fixtureFile, implode("\n", $envFileLines),); | ||
(new DotenvLoader($fixtureDir))->loadEnvironmentVariables(); | ||
$filesystem->remove($fixtureFile); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters