I rightly do not know what this all is
This commit is contained in:
parent
af6b2b752e
commit
287c1f67c5
78 changed files with 3484 additions and 3365 deletions
|
@ -1,35 +1,35 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\ORMSetup;
|
||||
use GamesShop\Environment\EnvironmentHandler;
|
||||
|
||||
final class DoctrineManager
|
||||
{
|
||||
public function setup() {
|
||||
$container = ContainerHandler::getInstance();
|
||||
|
||||
$environmentHandler = $container->get(EnvironmentHandler::class);
|
||||
|
||||
$config = ORMSetup::createAttributeMetadataConfiguration(
|
||||
paths: [ Paths::PHP_SOURCE_PATH . '/Entities' ],
|
||||
isDevMode: !$environmentHandler->isProduction()
|
||||
);
|
||||
|
||||
$dbEnvironment = $environmentHandler->getDatabaseEnvironment();
|
||||
$connection = DriverManager::getConnection($dbEnvironment->getDoctrineConfig());
|
||||
|
||||
$entityManager = new EntityManager($connection, $config);
|
||||
|
||||
$container->addShared(EntityManager::class, $entityManager);
|
||||
$container->addShared(EntityManagerInterface::class, $entityManager);
|
||||
$container->addShared(Connection::class, $connection);
|
||||
}
|
||||
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\ORMSetup;
|
||||
use GamesShop\Environment\EnvironmentHandler;
|
||||
|
||||
final class DoctrineManager
|
||||
{
|
||||
public function setup() {
|
||||
$container = ContainerHandler::getInstance();
|
||||
|
||||
$environmentHandler = $container->get(EnvironmentHandler::class);
|
||||
|
||||
$config = ORMSetup::createAttributeMetadataConfiguration(
|
||||
paths: [ Paths::PHP_SOURCE_PATH . '/Entities' ],
|
||||
isDevMode: !$environmentHandler->isProduction()
|
||||
);
|
||||
|
||||
$dbEnvironment = $environmentHandler->getDatabaseEnvironment();
|
||||
$connection = DriverManager::getConnection($dbEnvironment->getDoctrineConfig());
|
||||
|
||||
$entityManager = new EntityManager($connection, $config);
|
||||
|
||||
$container->addShared(EntityManager::class, $entityManager);
|
||||
$container->addShared(EntityManagerInterface::class, $entityManager);
|
||||
$container->addShared(Connection::class, $connection);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue