-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
31 lines (24 loc) · 1.04 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
<?php
use Doctrine\DBAL\Driver\PDOSqlite\Driver;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\ORM\Proxy\ProxyFactory;
require_once __DIR__ . '/vendor/autoload.php';
$configuration = new Configuration();
// We use annotations for loading the entities in our system
$configuration->setMetadataDriverImpl(new XmlDriver(__DIR__ . '/mapping'));
// This is needed for Doctrine to generate files required for lazy-loading
$configuration->setProxyDir(sys_get_temp_dir());
$configuration->setProxyNamespace('ProxyExample');
// We are telling Doctrine to always generate files required for lazy-loading. This is a slow operation,
// and shouldn't be done in a production environment.
$configuration->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_ALWAYS);
// Finally creating the EntityManager: our entry point for the ORM
return EntityManager::create(
[
'driverClass' => Driver::class,
'path' => __DIR__ . '/data/test-db.sqlite',
],
$configuration
);