-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from ray-di/env_slave
Slave can also be specified by environment variable
- Loading branch information
Showing
17 changed files
with
584 additions
and
199 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
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ray\AuraSqlModule; | ||
|
||
use Ray\AuraSqlModule\Pagerfanta\AuraSqlPagerModule; | ||
use Ray\Di\AbstractModule; | ||
|
||
use function preg_match; | ||
|
||
class AuraSqlBaseModule extends AbstractModule | ||
{ | ||
private string $dsn; | ||
|
||
public function __construct(string $dsnKey, ?AbstractModule $module = null) | ||
{ | ||
$this->dsn = $dsnKey; | ||
parent::__construct($module); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(): void | ||
{ | ||
// @Transactional | ||
$this->install(new TransactionalModule()); | ||
$this->install(new AuraSqlPagerModule()); | ||
preg_match(AuraSqlModule::PARSE_PDO_DSN_REGEX, $this->dsn, $parts); | ||
$dbType = $parts[1] ?? ''; | ||
$this->install(new AuraSqlQueryModule($dbType)); | ||
} | ||
} |
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
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
Oops, something went wrong.