function initialize() { parent::initialize(); $this->cache = new Doctrine\Common\Cache\ArrayCache(); $this->em->getConfiguration()->setMetadataCacheImpl($this->cache); $this->em->getConfiguration()->setQueryCacheImpl($this->cache); $this->em->getConfiguration()->setResultCacheImpl($this->cache); }
public function initialize() { require_once "vendor/autoload.php"; $cache = new \Doctrine\Common\Cache\ArrayCache(); $config = new Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl($cache); $driverImpl = $config->newDefaultAnnotationDriver(__DIR__ . '/models'); $config->setMetadataDriverImpl($driverImpl); $config->setQueryCacheImpl($cache); $config->setProxyDir(__DIR__ . '/proxies'); $config->setProxyNamespace('Proxies'); $config->setAutoGenerateProxyClasses(false); // no code generation in production $dbParams = array('driver' => 'pdo_sqlite', 'memory' => true); $this->em = Doctrine\ORM\EntityManager::create($dbParams, $config); if (!self::$classes) { self::$classes = $this->em->getMetadataFactory()->getAllMetadata(); } $schemaTool = new Doctrine\ORM\Tools\SchemaTool($this->em); $schemaTool->createSchema(self::$classes); require_once __DIR__ . '/proxies/AuthorProxy.php'; }
<?php require dirname(__FILE__) . '/Doctrine21TestSuite.php'; $time = microtime(true); $memory = memory_get_usage(true); $test = new Doctrine21TestSuite(); $test->initialize(); $test->run(); echo sprintf(" %11s | %6.2f |\n", number_format(memory_get_usage(true) - $memory), microtime(true) - $time);