summaryrefslogtreecommitdiff
path: root/src/model/doctrine-bootstrap.php
blob: 019dce4af7ca3554f7763c83e1e4191eb0d8ee90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// src/model/doctrine-bootstrap.php

use Doctrine\DBAL\DriverManager;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\ORMSetup;

require_once "vendor/autoload.php";

// Create a simple "default" Doctrine ORM configuration for Attributes
$config = ORMSetup::createAttributeMetadataConfiguration(
    paths: array('src/model/entities'),
    isDevMode: true,
);

// configuring the database connection
$connection = DriverManager::getConnection([
    'driver' => 'pdo_sqlite',
    'path' => 'data/' . Config::$db_name . '.sqlite',
], $config);

// obtaining the entity manager
$entityManager = new EntityManager($connection, $config);