2009-02-17 11:01:34 +03:00
|
|
|
<?php
|
2009-10-15 00:18:36 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2009-05-29 18:46:53 +04:00
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
namespace Sandbox;
|
2009-09-01 12:18:36 +04:00
|
|
|
|
2009-12-16 00:06:32 +03:00
|
|
|
use Doctrine\Common\ClassLoader,
|
|
|
|
Doctrine\ORM\Configuration,
|
2009-10-15 00:18:36 +04:00
|
|
|
Doctrine\ORM\EntityManager,
|
|
|
|
Doctrine\Common\Cache\ApcCache,
|
|
|
|
Entities\User, Entities\Address;
|
2009-09-11 23:50:48 +04:00
|
|
|
|
2009-12-16 00:06:32 +03:00
|
|
|
require '../../lib/Doctrine/Common/ClassLoader.php';
|
2009-09-11 23:50:48 +04:00
|
|
|
|
2009-12-16 00:06:32 +03:00
|
|
|
// 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();
|
2009-09-11 23:50:48 +04:00
|
|
|
|
|
|
|
// Set up caches
|
2009-10-15 00:18:36 +04:00
|
|
|
$config = new Configuration;
|
|
|
|
$cache = new ApcCache;
|
2009-09-11 23:50:48 +04:00
|
|
|
$config->setMetadataCacheImpl($cache);
|
|
|
|
$config->setQueryCacheImpl($cache);
|
|
|
|
|
2009-10-15 00:18:36 +04:00
|
|
|
// Proxy configuration
|
|
|
|
$config->setProxyDir(__DIR__ . '/Proxies');
|
|
|
|
$config->setProxyNamespace('Proxies');
|
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
// Database connection information
|
|
|
|
$connectionOptions = array(
|
|
|
|
'driver' => 'pdo_sqlite',
|
|
|
|
'path' => 'database.sqlite'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Create EntityManager
|
2009-10-15 00:18:36 +04:00
|
|
|
$em = EntityManager::create($connectionOptions, $config);
|
2009-09-11 23:50:48 +04:00
|
|
|
|
|
|
|
## PUT YOUR TEST CODE BELOW
|
|
|
|
|
|
|
|
$user = new User;
|
|
|
|
$address = new Address;
|
|
|
|
|
2010-01-22 18:10:13 +03:00
|
|
|
echo 'Hello World!' . PHP_EOL;
|
|
|
|
|