From da382fae494ec232f5a5838b3f8ec437f7d97e81 Mon Sep 17 00:00:00 2001 From: RJ Garcia Date: Fri, 17 Feb 2017 08:47:06 -0800 Subject: [PATCH] Fixing default caching bug introduced from #205 If you have memcached or redis extensions installed doctrine will try to automatically connect to one of them if no cache paramter is set when dev mode is off. Defaulting to the default driver to prevent that behavior from occuring. Signed-off-by: RJ Garcia --- src/EntityManagerFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/EntityManagerFactory.php b/src/EntityManagerFactory.php index cc7488af..80ed704b 100644 --- a/src/EntityManagerFactory.php +++ b/src/EntityManagerFactory.php @@ -2,6 +2,7 @@ namespace LaravelDoctrine\ORM; +use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Cache\Cache; use Doctrine\ORM\Cache\DefaultCacheFactory; use Doctrine\ORM\Configuration; @@ -92,9 +93,12 @@ public function __construct( */ public function create(array $settings = []) { + $defaultDriver = $this->config->get('doctrine.cache.default', 'array'); + $configuration = $this->setup->createConfiguration( array_get($settings, 'dev', false), - array_get($settings, 'proxies.path') + array_get($settings, 'proxies.path'), + $this->cache->driver($defaultDriver) ); $this->setMetadataDriver($settings, $configuration);