initial commit
This commit is contained in:
31
doctrine-config.php
Normal file
31
doctrine-config.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// doctrine-config.php
|
||||
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\ORMSetup;
|
||||
|
||||
require_once "vendor/autoload.php";
|
||||
require_once "config.php";
|
||||
|
||||
// Pfad zu den Entity-Klassen
|
||||
$paths = [__DIR__ . "/src/Entity"];
|
||||
$isDevMode = true;
|
||||
|
||||
// Doctrine ORM Konfiguration
|
||||
$config = ORMSetup::createAttributeMetadataConfiguration($paths, $isDevMode);
|
||||
|
||||
// Datenbankverbindungs-Parameter aus config.php
|
||||
$connectionParams = [
|
||||
'driver' => 'pdo_mysql',
|
||||
'host' => $databaseHost,
|
||||
'user' => $databaseUser,
|
||||
'password' => $databasePassword,
|
||||
'dbname' => $databaseDatabase,
|
||||
'charset' => 'utf8mb4',
|
||||
];
|
||||
|
||||
$connection = DriverManager::getConnection($connectionParams, $config);
|
||||
$entityManager = new EntityManager($connection, $config);
|
||||
|
||||
return $entityManager;
|
||||
Reference in New Issue
Block a user