-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
104 lines (77 loc) · 2.76 KB
/
app.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
require_once __DIR__.'/../../vendor/autoload.php';
define('WEB_DIRECTORY', __DIR__.'/../../web');
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Silex\Provider\FormServiceProvider;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\User;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Common\Cache\ApcCache;
use Doctrine\Common\Cache\ArrayCache;
use Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
$app = new Silex\Application();
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'dbname' => 'rwm',
'user' => 'root',
'password' => 'root23',
'host' => '127.0.0.1',
'driver' => 'pdo_mysql',
),
));
$app->register(new DoctrineOrmServiceProvider, array(
"orm.proxies_dir" => __DIR__ . '/../../cache/doctrine/proxy',
"orm.em.options" => array(
"mappings" => array(
// Using actual filesystem paths
array(
"type" => "annotation",
"namespace" => "DrkMedia\Entity",
"path" => __DIR__."/../../src/DrkMedia/Entity",
),
array(
"type" => "xml",
"namespace" => "Bat\Entities",
"path" => __DIR__."/src/Bat/Resources/mappings",
),
// Using PSR-0 namespaceish embedded resources
// (requires registering a PSR-0 Resource Locator
// Service Provider)
/*
array(
"type" => "annotation",
"namespace" => "Baz\Entities",
"resources_namespace" => "Baz\Entities",
),
array(
"type" => "xml",
"namespace" => "Bar\Entities",
"resources_namespace" => "Bar\Resources\mappings",
),
*/
),
),
));
$app->register(new FormServiceProvider()); // has to be before twig ! o_o
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'translator.domains' => array(),
));
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/Resources/views',
'twig.form.resources' => __DIR__.'/Resources/form',
));
// 'twig.form.templates' => array(__DIR__.'/Resources/form/form_edit_layout.html.twig'),
// prevent weird error
function dummy_trans($str) {
return $str;
}
$app['twig']->addFilter('trans*', new Twig_Filter_Function('dummy_trans'));
$app['debug'] = true;
return $app;