blob: 029b1b12232ae4de38c4ff75b8c99d5f24a3960b (
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
25
26
27
28
29
30
31
|
<?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(__DIR__.'/entities'),
paths: array('src/model/entities'),
isDevMode: true,
);
// or if you prefer XML
// $config = ORMSetup::createXMLMetadataConfiguration(
// paths: array(__DIR__."/config/xml"),
// isDevMode: true,
//);
// configuring the database connection
$connection = DriverManager::getConnection([
'driver' => 'pdo_sqlite',
//'path' => __DIR__ . '/../../data/' . Config::$db_name . '.sqlite',
'path' => 'data/' . Config::$db_name . '.sqlite',
], $config);
// obtaining the entity manager
$entityManager = new EntityManager($connection, $config);
|