-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.sample.php
More file actions
50 lines (39 loc) · 1.54 KB
/
config.sample.php
File metadata and controls
50 lines (39 loc) · 1.54 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
48
49
50
<?php
define("POW_DIFICULTY", 4);
define("SEED_PEER_IP", "127.0.0.1");
define("SEED_PEER_PORT", "8080");
define("PORT_API", 8080);
define("PORT_WEB", 8081);
define("BIND_ADDRESS", "127.0.0.1");
define("MASTER_NODE", true);
if (!file_exists($file = __DIR__ . '/vendor/autoload.php')) {
throw new RuntimeException('Install dependencies to run this script.');
}
$loader = require_once $file;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\MongoDB\Connection;
use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
use Predis\Client;
$builder = new DI\ContainerBuilder();
$builder->useAnnotations(true);
$builder->addDefinitions([
Doctrine\ODM\MongoDB\DocumentManager::class => DI\factory(function () use ($loader) {
$loader->add('Documents', __DIR__ . '/src');
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
$connection = new Connection();
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/src/Proxies');
$config->setProxyNamespace('Proxies');
$config->setHydratorDir(__DIR__ . '/src/Hydrators');
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm');
$config->setMetadataDriverImpl(AnnotationDriver::create(__DIR__ . '/src'));
return DocumentManager::create($connection, $config);
}),
Predis\Client::class => DI\factory(function () {
return new Client();
})
]);
$container = $builder->build();