-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
30 lines (23 loc) · 786 Bytes
/
bootstrap.php
File metadata and controls
30 lines (23 loc) · 786 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
<?php declare(strict_types=1);
use App\Context;
use App\Query;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
//use Dotenv\Dotenv;
use Monolog\Handler\ErrorLogHandler;
use Siler\Monolog as Log;
use function Siler\Env\env_var;
use function Siler\GraphQL\annotated;
require_once __DIR__ . '/vendor/autoload.php';
//Dotenv::createImmutable(__DIR__)->load();
Log\handler(new ErrorLogHandler());
$schema = annotated([Query::class]);
$root_value = null;
$context = new Context();
$dev_mode = env_var('APP_ENV') === 'development';
$config = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/src'], $dev_mode, null, null, false);
$conn = [
'driver' => 'pdo_sqlite',
'path' => __DIR__ . '/db.sqlite',
];
$context->em = EntityManager::create($conn, $config);