1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/tools/sandbox/index.php

35 lines
917 B
PHP
Raw Normal View History

<?php
2009-05-29 18:46:53 +04:00
namespace Sandbox;
use Entities\User, Entities\Address;
require '../../lib/Doctrine/Common/GlobalClassLoader.php';
// Set up class loading, we could alternatively use 2 IsolatedClassLoaders
$classLoader = new \Doctrine\Common\GlobalClassLoader();
$classLoader->registerNamespace('Doctrine', realpath(__DIR__ . '/../../lib'));
$classLoader->registerNamespace('Entities', __DIR__);
$classLoader->register();
// Set up caches
$config = new \Doctrine\ORM\Configuration;
$cache = new \Doctrine\Common\Cache\ApcCache;
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Database connection information
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite'
);
// Create EntityManager
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
## PUT YOUR TEST CODE BELOW
$user = new User;
$address = new Address;
echo "Hello World!";