forget add changes
This commit is contained in:
parent
7430320bac
commit
dca0881d94
@ -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);
|
@ -1,27 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
|
$em = require_once __DIR__.'/bootstrap.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';
|
|
||||||
|
|
||||||
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\Common\Version::VERSION);
|
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\Common\Version::VERSION);
|
||||||
$cli->setCatchExceptions(true);
|
$cli->setCatchExceptions(true);
|
||||||
|
|
||||||
// Variable $helpers is defined inside cli-config.php
|
// 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(
|
$cli->addCommands(array(
|
||||||
// DBAL Commands
|
// DBAL Commands
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Welcome to Doctrine 2.
|
* Welcome to Doctrine 2.
|
||||||
*
|
*
|
||||||
* This is the index file of the sandbox. The first section of this file
|
* This is the index file of the sandbox. The first section of this file
|
||||||
* demonstrates the bootstrapping and configuration procedure of Doctrine 2.
|
* demonstrates the bootstrapping and configuration procedure of Doctrine 2.
|
||||||
* Below that section you can place your test code and experiment.
|
* Below that section you can place your test code and experiment.
|
||||||
@ -9,50 +9,10 @@
|
|||||||
|
|
||||||
namespace Sandbox;
|
namespace Sandbox;
|
||||||
|
|
||||||
use Doctrine\Common\ClassLoader,
|
use Entities\Address;
|
||||||
Doctrine\ORM\Configuration,
|
use Entities\User;
|
||||||
Doctrine\ORM\EntityManager,
|
|
||||||
Doctrine\Common\Cache\ApcCache,
|
|
||||||
Entities\User, Entities\Address;
|
|
||||||
|
|
||||||
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
|
$em = require_once __DIR__ . '/bootstrap.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);
|
|
||||||
|
|
||||||
## PUT YOUR TEST CODE BELOW
|
## PUT YOUR TEST CODE BELOW
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user