Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tools / sandbox / index.php
1 <?php
2 /**
3  * Welcome to Doctrine 2.
4  * 
5  * This is the index file of the sandbox. The first section of this file
6  * demonstrates the bootstrapping and configuration procedure of Doctrine 2.
7  * Below that section you can place your test code and experiment.
8  */
9
10 namespace Sandbox;
11
12 use Doctrine\Common\ClassLoader,
13     Doctrine\ORM\Configuration,
14     Doctrine\ORM\EntityManager,
15     Doctrine\Common\Cache\ApcCache,
16     Entities\User, Entities\Address;
17
18 require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
19
20 // Set up class loading. You could use different autoloaders, provided by your favorite framework,
21 // if you want to.
22 $classLoader = new ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
23 $classLoader->register();
24 $classLoader = new ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
25 $classLoader->register();
26 $classLoader = new ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
27 $classLoader->register();
28 $classLoader = new ClassLoader('Symfony', realpath(__DIR__ . '/../../lib/vendor'));
29 $classLoader->register();
30 $classLoader = new ClassLoader('Entities', __DIR__);
31 $classLoader->register();
32 $classLoader = new ClassLoader('Proxies', __DIR__);
33 $classLoader->register();
34
35 // Set up caches
36 $config = new Configuration;
37 $cache = new ApcCache;
38 $config->setMetadataCacheImpl($cache);
39 $driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
40 $config->setMetadataDriverImpl($driverImpl);
41 $config->setQueryCacheImpl($cache);
42
43 // Proxy configuration
44 $config->setProxyDir(__DIR__ . '/Proxies');
45 $config->setProxyNamespace('Proxies');
46 $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
47
48 // Database connection information
49 $connectionOptions = array(
50     'driver' => 'pdo_sqlite',
51     'path' => 'database.sqlite'
52 );
53
54 // Create EntityManager
55 $em = EntityManager::create($connectionOptions, $config);
56
57 ## PUT YOUR TEST CODE BELOW
58
59 $user = new User;
60 $address = new Address;
61
62 echo 'Hello World!' . PHP_EOL;