Completed
Push — master ( a8fe50...bce26f )
by Maciej
13s
created

tools/sandbox/config.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
use Doctrine\Common\Annotations\AnnotationRegistry;
6
use Doctrine\MongoDB\Connection;
7
use Doctrine\ODM\MongoDB\Configuration;
8
use Doctrine\ODM\MongoDB\DocumentManager;
9
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
10
11
$file = __DIR__ . '/../../vendor/autoload.php';
12
13
if (! file_exists($file)) {
14
    throw new RuntimeException('Install dependencies to run this script.');
15
}
16
17
$loader = require_once $file;
18
$loader->add('Documents', __DIR__);
19
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...istry::registerLoader() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
20
21
$connection = new Connection();
22
23
$config = new Configuration();
24
$config->setProxyDir(__DIR__ . '/Proxies');
25
$config->setProxyNamespace('Proxies');
26
$config->setHydratorDir(__DIR__ . '/Hydrators');
27
$config->setHydratorNamespace('Hydrators');
28
$config->setDefaultDB('doctrine_odm_sandbox');
29
// $config->setLoggerCallable(function(array $log) { print_r($log); });
30
// $config->setMetadataCacheImpl(new Doctrine\Common\Cache\ApcCache());
31
$config->setMetadataDriverImpl(AnnotationDriver::create(__DIR__ . '/Documents'));
32
33
$dm = DocumentManager::create($connection, $config);
34