forked from doctrine/mongodb-odm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
36 lines (24 loc) · 1.04 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
<?php
use Doctrine\Common\ClassLoader;
use Doctrine\MongoDB\Connection;
use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
$file = __DIR__.'/../../vendor/autoload.php';
if (!file_exists($file)) {
throw new RuntimeException('Install dependencies to run the sandbox.');
}
require_once $file;
AnnotationDriver::registerAnnotationClasses();
$classLoader = new ClassLoader('Documents', __DIR__);
$classLoader->register();
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setHydratorDir(__DIR__ . '/Hydrators');
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm_sandbox');
// $config->setLoggerCallable(function(array $log) { print_r($log); });
// $config->setMetadataCacheImpl(new Doctrine\Common\Cache\ApcCache());
$config->setMetadataDriverImpl(AnnotationDriver::create(__DIR__ . '/Documents'));
$dm = DocumentManager::create(new Connection(), $config);