index.php 1.47 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
use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
14 15 16
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ApcCache,
    Entities\User, Entities\Address;
17

18
require '../../lib/Doctrine/Common/ClassLoader.php';
19

20 21 22 23 24 25 26 27
// Set up class loading. You could use different autoloaders, provided by your favorite framework,
// if you want to.
$doctrineClassLoader = new ClassLoader('Doctrine', realpath(__DIR__ . '/../../lib'));
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('Entities', __DIR__);
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', __DIR__);
$proxiesClassLoader->register();
28 29

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

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

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

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

## PUT YOUR TEST CODE BELOW

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

53 54
echo 'Hello World!' . PHP_EOL;