-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #142 - remove doctrine dependency in anonymizator and stats pro…
…vider (#144)
- Loading branch information
Showing
10 changed files
with
100 additions
and
46 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
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,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MakinaCorpus\DbToolsBundle\Database; | ||
|
||
use MakinaCorpus\QueryBuilder\DatabaseSession; | ||
|
||
/** | ||
* Main entry point for plugging this component to any framework. | ||
*/ | ||
interface DatabaseSessionRegistry | ||
{ | ||
/** | ||
* Get all known connection names. | ||
* | ||
* @return string[] | ||
*/ | ||
public function getConnectionNames(): array; | ||
|
||
/** | ||
* Get database session for given connection name. | ||
*/ | ||
public function getDatabaseSession(string $connectionName): DatabaseSession; | ||
} |
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MakinaCorpus\DbToolsBundle\Database; | ||
|
||
use Doctrine\Persistence\ManagerRegistry; | ||
use MakinaCorpus\QueryBuilder\Bridge\Doctrine\DoctrineQueryBuilder; | ||
use MakinaCorpus\QueryBuilder\DatabaseSession; | ||
|
||
/** | ||
* doctrine/dbal based implementation. | ||
*/ | ||
class DoctrineDatabaseSessionRegistry implements DatabaseSessionRegistry | ||
{ | ||
public function __construct( | ||
private ManagerRegistry $doctrineRegistry, | ||
) {} | ||
|
||
#[\Override] | ||
public function getConnectionNames(): array | ||
{ | ||
return \array_keys($this->doctrineRegistry->getConnections()); | ||
} | ||
|
||
#[\Override] | ||
public function getDatabaseSession(string $connectionName): DatabaseSession | ||
{ | ||
return new DoctrineQueryBuilder($this->doctrineRegistry->getConnection($connectionName)); | ||
} | ||
} |
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