-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
35 lines (25 loc) · 895 Bytes
/
bootstrap.php
File metadata and controls
35 lines (25 loc) · 895 Bytes
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
<?php
require 'vendor/autoload.php';
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$isDevMode = false;
$paths = array(__DIR__ . '/src/Model');
$dbParams = array(
'driver' => 'pdo_pgsql'
,'host' => 'localhost'
,'port' => '5432'
,'user' => 'postgres'
,'password' => '#clare47*#'
,'dbname' => 'api_silex'
,'charset' => 'UTF8'
);
$config = Setup::createConfiguration($isDevMode);
$driver = new AnnotationDriver(new AnnotationReader(), $paths);
$config->setMetadataDriverImpl($driver);
AnnotationRegistry::registerFile(
__DIR__ . '/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);
$entityManager = EntityManager::create($dbParams, $config);