2009-02-17 08:01:34 +00:00
|
|
|
<?php
|
2009-05-29 14:46:53 +00:00
|
|
|
|
2009-02-17 08:01:34 +00:00
|
|
|
require '../../lib/Doctrine/Common/ClassLoader.php';
|
|
|
|
|
|
|
|
$classLoader = new \Doctrine\Common\ClassLoader();
|
|
|
|
$classLoader->setBasePath('Doctrine', realpath(__DIR__ . '/../../lib'));
|
|
|
|
$classLoader->setBasePath('Entities', __DIR__);
|
|
|
|
|
2009-08-31 16:21:29 +00:00
|
|
|
$config = new \Doctrine\ORM\Configuration;
|
2009-09-01 19:59:58 +00:00
|
|
|
$cache = new \Doctrine\Common\Cache\ApcCache;
|
|
|
|
// Use ArrayCache is APC is not available
|
|
|
|
// Warning without APC Doctrine will not perform as well
|
2009-09-01 19:54:48 +00:00
|
|
|
$cache = new \Doctrine\Common\Cache\ArrayCache;
|
2009-08-31 16:21:29 +00:00
|
|
|
$config->setMetadataCacheImpl($cache);
|
|
|
|
$config->setQueryCacheImpl($cache);
|
|
|
|
|
|
|
|
# EXAMPLE FOR YAML DRIVER
|
|
|
|
#$config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/yaml'));
|
|
|
|
|
|
|
|
# EXAMPLE FOR XML DRIVER
|
|
|
|
#$config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/xml'));
|
|
|
|
|
2009-02-17 08:01:34 +00:00
|
|
|
$eventManager = new \Doctrine\Common\EventManager();
|
|
|
|
$connectionOptions = array(
|
|
|
|
'driver' => 'pdo_sqlite',
|
|
|
|
'path' => 'database.sqlite'
|
|
|
|
);
|
2009-09-01 19:59:58 +00:00
|
|
|
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
|