/
config.php
56 lines (44 loc) · 1.72 KB
/
config.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
<?php
/**
* this file should return an array, to be consumed by the
* php-di container builder
*
* DO NOT EDIT THIS FILE.
* If you want to add configuration, you should create a
* local-config.php to add, replace or decorate the
* configuration from this file.
*/
use function \DI\get;
use function \DI\object;
use function \DI\decorate;
use function \DI\factory;
return [
// Doctrine ORM settings
'doctrine.orm.connection' => [
'driver' => 'pdo_sqlite',
'path' => __DIR__ . '/exampledb.db',
],
'doctrine.orm.config' => function() {
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(
array(__DIR__."/src"), true, null, null, false);
$config->setEntityNamespaces(['e'=>'\Webmaster777\BoardGameCollection\Entity']);
return $config;
},
\Doctrine\ORM\EntityManager::class => factory([\Doctrine\ORM\EntityManager::class, 'create'])
->parameter('conn', get('doctrine.orm.connection'))
->parameter('config',get('doctrine.orm.config')),
'doctrine.orm.helperset' => function( Interop\Container\ContainerInterface $container ) {
$entityManager = $container->get(\Doctrine\ORM\EntityManager::class);
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);
},
// Slim app
\Slim\App::class => function(\Psr\Container\ContainerInterface $container) {
$app = new \Slim\App($container);
$app->get('/',function(\Psr\Http\Message\ResponseInterface $response) {
return $response->withStatus(501);
});
$app->get('/games', \Webmaster777\BoardGameCollection\Controller\GetGamesController::class);
$app->post('/games/new', \Webmaster777\BoardGameCollection\Controller\PostNewGameController::class);
return $app;
}
];