-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.php
More file actions
47 lines (38 loc) · 1.3 KB
/
app.php
File metadata and controls
47 lines (38 loc) · 1.3 KB
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
45
46
47
<?php
require "bootstrap.php";
use Silex\Application;
use Api\Service\RouterServiceProvider;
use Api\Service\ControllerServiceProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Silex\Provider\ServiceControllerServiceProvider;
$app = new Application();
$app['debug'] = true;
$app['api_version'] = '/v1';
$app->after(function (Request $request, Response $response){
$response->headers->set('Content-Type', 'application/json');
});
$app->register(new RouterServiceProvider());
$app->register(new ControllerServiceProvider());
$app->register(new ServiceControllerServiceProvider());
$app->register(new \Silex\Provider\DoctrineServiceProvider(), array(
'dbs.options' => array(
'default' => $dbParams
)
));
$app->register(new \Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider(), array(
'orm.proxies_dir' => '/tmp',
'orm.em.options' => array(
'mappings' => array(
array(
'type' => 'annotation',
'use_simple_annotation_reader' => false,
'namespace' => 'Api\Model',
'path' => __DIR__ . '/src'
),
),
),
'orm.proxies_namespace' => 'EntityProxy',
'orm.auto_generate_proxies' => true,
'orm.default_cache' => 'array'
));