-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
44 lines (34 loc) · 1.16 KB
/
bootstrap.php
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
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// include the composer autoloader for autoloading packages
use Doctrine\ORM\EntityManager;
use iRAP\Autoloader\Autoloader;
$dotenv = \Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
// set up an autoloader for loading classes that aren't in /vendor
// $classDirs is an array of all folders to load from
$classDirs = array(
__DIR__,
__DIR__ . '/entities',
);
new Autoloader($classDirs);
function getEntityManager(): EntityManager
{
$entityManager = null;
if ($entityManager === null) {
$paths = array(__DIR__ . '/entities');
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths);
# set up configuration parameters for doctrine.
# Make sure you have installed the php7.0-sqlite package.
$connectionParams = array(
'driver' => 'pdo_mysql',
'user' => 'sdkuser',
'password' => 'secret',
'host' => 'mysql',
'port' => 3306,
'dbname' => 'cartdb',
);
$entityManager = EntityManager::create($connectionParams, $config);
}
return $entityManager;
}