1
0
mirror of synced 2024-12-04 18:56:06 +03:00

forget add changes

This commit is contained in:
Gusakov Nikita 2013-05-18 01:42:55 +04:00
parent 7430320bac
commit dca0881d94
3 changed files with 44 additions and 61 deletions

View File

@ -0,0 +1,35 @@
<?php
use Doctrine\Common\Cache\ApcCache;
use Doctrine\ORM\EntityManager;
$loader = require __DIR__ . '/../../vendor/autoload.php';
// Set up class loading. You could use different autoloaders, provided by your favorite framework,
// if you want to.
$loader->add('Entities', __DIR__);
$loader->add('Proxies', __DIR__);
$config = new \Doctrine\ORM\Configuration();
// Set up Metadata Drivers
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . "/Entities"));
$config->setMetadataDriverImpl($driverImpl);
// Set up caches
$cache = new ApcCache;
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
// Proxy configuration
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
// Database connection information
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite'
);
return EntityManager::create($connectionOptions, $config);

View File

@ -1,27 +1,15 @@
<?php
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', realpath(__DIR__ . '/../../lib/vendor'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
require __DIR__ . '/cli-config.php';
$em = require_once __DIR__.'/bootstrap.php';
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\Common\Version::VERSION);
$cli->setCatchExceptions(true);
// Variable $helpers is defined inside cli-config.php
$cli->setHelperSet($helpers);
$cli->setHelperSet(new Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
)));
$cli->addCommands(array(
// DBAL Commands

View File

@ -1,7 +1,7 @@
<?php
/**
* 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.
@ -9,50 +9,10 @@
namespace Sandbox;
use Doctrine\Common\ClassLoader,
Doctrine\ORM\Configuration,
Doctrine\ORM\EntityManager,
Doctrine\Common\Cache\ApcCache,
Entities\User, Entities\Address;
use Entities\Address;
use Entities\User;
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
// Set up class loading. You could use different autoloaders, provided by your favorite framework,
// if you want to.
$classLoader = new ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
$classLoader->register();
$classLoader = new ClassLoader('Symfony', realpath(__DIR__ . '/../../lib/vendor'));
$classLoader->register();
$classLoader = new ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new ClassLoader('Proxies', __DIR__);
$classLoader->register();
// Set up caches
$config = new Configuration;
$cache = new ApcCache;
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
// Database connection information
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite'
);
// Create EntityManager
$em = EntityManager::create($connectionOptions, $config);
$em = require_once __DIR__ . '/bootstrap.php';
## PUT YOUR TEST CODE BELOW