From 4fc7389b1da3cc918beb642c9f79c0e6586b8047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Osman=20U=CC=88ngu=CC=88r?= Date: Mon, 2 Apr 2012 11:57:09 +0300 Subject: [PATCH 1/2] New cache driver definition for Doctrine running in non-dev mode and cache driver is not set. This cache driver was added with doctrine/common#109 --- lib/Doctrine/ORM/Tools/Setup.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/Setup.php b/lib/Doctrine/ORM/Tools/Setup.php index 9765214ec..92066aeb4 100644 --- a/lib/Doctrine/ORM/Tools/Setup.php +++ b/lib/Doctrine/ORM/Tools/Setup.php @@ -173,6 +173,11 @@ class Setup $memcache->connect('127.0.0.1'); $cache = new \Doctrine\Common\Cache\MemcacheCache(); $cache->setMemcache($memcache); + } else if (extension_loaded('redis')) { + $redis = new \Redis(); + $redis->connect('127.0.0.1'); + $cache = new \Doctrine\Common\Cache\RedisCache(); + $cache->setRedis($redis); } else { $cache = new ArrayCache; } From e69b0224724da9f70ee3198b493dc0d5fd25cba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Osman=20U=CC=88ngu=CC=88r?= Date: Mon, 2 Apr 2012 12:11:38 +0300 Subject: [PATCH 2/2] Fixed CS --- lib/Doctrine/ORM/Tools/Setup.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/Setup.php b/lib/Doctrine/ORM/Tools/Setup.php index 92066aeb4..96a412e2b 100644 --- a/lib/Doctrine/ORM/Tools/Setup.php +++ b/lib/Doctrine/ORM/Tools/Setup.php @@ -165,9 +165,9 @@ class Setup $proxyDir = $proxyDir ?: sys_get_temp_dir(); if ($isDevMode === false && $cache === null) { if (extension_loaded('apc')) { - $cache = new \Doctrine\Common\Cache\ApcCache; + $cache = new \Doctrine\Common\Cache\ApcCache(); } else if (extension_loaded('xcache')) { - $cache = new \Doctrine\Common\Cache\XcacheCache; + $cache = new \Doctrine\Common\Cache\XcacheCache(); } else if (extension_loaded('memcache')) { $memcache = new \Memcache(); $memcache->connect('127.0.0.1'); @@ -179,10 +179,10 @@ class Setup $cache = new \Doctrine\Common\Cache\RedisCache(); $cache->setRedis($redis); } else { - $cache = new ArrayCache; + $cache = new ArrayCache(); } } else if ($cache === null) { - $cache = new ArrayCache; + $cache = new ArrayCache(); } $cache->setNamespace("dc2_" . md5($proxyDir) . "_"); // to avoid collisions @@ -190,7 +190,7 @@ class Setup $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $config->setResultCacheImpl($cache); - $config->setProxyDir( $proxyDir ); + $config->setProxyDir($proxyDir); $config->setProxyNamespace('DoctrineProxies'); $config->setAutoGenerateProxyClasses($isDevMode);