index.php 1.45 KB
Newer Older
1
<?php
2 3 4 5 6 7 8
/**
 * Welcome to Doctrine 2.
 * 
 * This is the index file of the sandbox. The first section of this file
 * demonstrates the bootstrapping and configuration procedure of Doctrine 2.
 * Below that section you can place your test code and experiment.
 */
jwage's avatar
jwage committed
9

10
namespace Sandbox;
11

12 13 14 15
use Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ApcCache,
    Entities\User, Entities\Address;
16 17 18

require '../../lib/Doctrine/Common/GlobalClassLoader.php';

19 20
// Set up class loading, we could alternatively use several IsolatedClassLoaders.
// You could also use different autoloaders, provided by your favorite framework.
21 22 23
$classLoader = new \Doctrine\Common\GlobalClassLoader();
$classLoader->registerNamespace('Doctrine', realpath(__DIR__ . '/../../lib'));
$classLoader->registerNamespace('Entities', __DIR__);
24
$classLoader->registerNamespace('Proxies', __DIR__);
25 26 27
$classLoader->register();

// Set up caches
28 29
$config = new Configuration;
$cache = new ApcCache;
30 31 32
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);

33 34 35 36
// Proxy configuration
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');

37 38 39 40 41 42 43
// Database connection information
$connectionOptions = array(
    'driver' => 'pdo_sqlite',
    'path' => 'database.sqlite'
);

// Create EntityManager
44
$em = EntityManager::create($connectionOptions, $config);
45 46 47 48 49 50

## PUT YOUR TEST CODE BELOW

$user = new User;
$address = new Address;

51
echo 'Hello World!' . PHP_EOL;