-
Notifications
You must be signed in to change notification settings - Fork 4
/
bootstrap.php
34 lines (25 loc) · 1.12 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
<?php
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Configuration;
use Doctrine\Common\Annotations\AnnotationRegistry;
//use Doctrine\Common\Annotations\AnnotationReader;
$loader = require __DIR__.'/vendor/autoload.php';
$loader->add('Api', __DIR__.'/src');
$config = new Configuration();
$config->setProxyDir('/tmp');
$config->setProxyNamespace('EntityProxy');
$config->setAutoGenerateProxyClasses(true);
AnnotationRegistry::registerFile(__DIR__. DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . 'orm' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Doctrine' . DIRECTORY_SEPARATOR . 'ORM' . DIRECTORY_SEPARATOR . 'Mapping' . DIRECTORY_SEPARATOR . 'Driver' . DIRECTORY_SEPARATOR . 'DoctrineAnnotations.php');
$driver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver(
new Doctrine\Common\Annotations\AnnotationReader(),
array(__DIR__ . DIRECTORY_SEPARATOR . 'src')
);
$config->setMetadataDriverImpl($driver);
$db = require_once __DIR__ . '/config/db.php';
if (!$db) {
throw new \Exception("Error Processing Config db", 1);
}
$em = EntityManager::create(
$db['options'],
$config
);